Skip to content

Commit

Permalink
feat: more blocks for theming login and password pages
Browse files Browse the repository at this point in the history
  • Loading branch information
azmeuk committed May 21, 2024
1 parent d356e1b commit 61da068
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 48 deletions.
58 changes: 33 additions & 25 deletions canaille/core/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,45 @@
<div class="ui container" hx-boost="false">
<div class="content">
<div class="ui clearing segment">
{% if logo_url %}
<a href="{{ url_for('core.account.index') }}">
<img class="ui tiny centered image" src="{{ logo_url }}" alt="{{ website_name }}">
</a>
{% else %}
<i class="massive sign in icon image ui"></i>
{% endif %}
{% block header %}
{% if logo_url %}
<a href="{{ url_for('core.account.index') }}">
<img class="ui tiny centered image" src="{{ logo_url }}" alt="{{ website_name }}">
</a>
{% else %}
<i class="massive sign in icon image ui"></i>
{% endif %}

<h2 class="ui center aligned header">
<div class="content">
{{ _("Sign in at %(website)s", website=website_name) }}
</div>
<div class="sub header">{% trans %}Manage your information and your authorizations{% endtrans %}</div>
</h2>
<h2 class="ui center aligned header">
<div class="content">
{{ _("Sign in at %(website)s", website=website_name) }}
</div>
<div class="sub header">{% trans %}Manage your information and your authorizations{% endtrans %}</div>
</h2>
{% endblock %}

{{ flask.messages() }}
{% block messages %}
{{ flask.messages() }}
{% endblock %}

{% call fui.render_form(form) %}
{% block login_field scoped %}{{ login_field.render_field(form.login, class="autofocus") }}{% endblock %}
{% block fields %}
{% block login_field scoped %}{{ login_field.render_field(form.login, class="autofocus") }}{% endblock %}
{% endblock %}

<div class="ui right aligned container">
<div class="ui stackable buttons">
{% if features.has_registration %}
<a type="button" class="ui right floated button" href="{{ url_for('core.account.join') }}">{{ _("Create an account") }}</a>
{% endif %}
{% if features.has_smtp and features.has_password_recovery %}
<a type="button" class="ui right floated button" href="{{ url_for('core.auth.forgotten') }}">{{ _("Forgotten password") }}</a>
{% endif %}
<button type="submit" name="answer" class="ui right floated primary button" hx-boost="false">{{ _("Continue") }}</button>
{% block buttons %}
<div class="ui right aligned container">
<div class="ui stackable buttons">
{% if features.has_registration %}
<a type="button" class="ui right floated button" href="{{ url_for('core.account.join') }}">{{ _("Create an account") }}</a>
{% endif %}
{% if features.has_smtp and features.has_password_recovery %}
<a type="button" class="ui right floated button" href="{{ url_for('core.auth.forgotten') }}">{{ _("Forgotten password") }}</a>
{% endif %}
<button type="submit" name="answer" class="ui right floated primary button" hx-boost="false">{{ _("Continue") }}</button>
</div>
</div>
</div>
{% endblock %}
{% endcall %}
</div>
</div>
Expand Down
54 changes: 31 additions & 23 deletions canaille/core/templates/password.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,43 @@
<div class="ui container">
<div class="content">
<div class="ui clearing segment">
{% if logo_url %}
<a href="{{ url_for('core.account.index') }}">
<img class="ui tiny centered image" src="{{ logo_url }}" alt="{{ website_name }}">
</a>
{% else %}
<i class="massive sign in icon image ui"></i>
{% endif %}
{% block header %}
{% if logo_url %}
<a href="{{ url_for('core.account.index') }}">
<img class="ui tiny centered image" src="{{ logo_url }}" alt="{{ website_name }}">
</a>
{% else %}
<i class="massive sign in icon image ui"></i>
{% endif %}

<h2 class="ui center aligned header">
<div class="content">
{{ _("Sign in as %(username)s", username=username) }}
</div>
<div class="sub header">{% trans %}Please enter your password for this account.{% endtrans %}</div>
</h2>
<h2 class="ui center aligned header">
<div class="content">
{{ _("Sign in as %(username)s", username=username) }}
</div>
<div class="sub header">{% trans %}Please enter your password for this account.{% endtrans %}</div>
</h2>
{% endblock %}

{{ flask.messages() }}
{% block messages %}
{{ flask.messages() }}
{% endblock %}

{% call fui.render_form(form, hx_boost="false") %}
{{ login_field.render_field(form.password, class="autofocus") }}
{% block fields %}
{{ login_field.render_field(form.password, class="autofocus") }}
{% endblock %}

<div class="ui right aligned container">
<div class="ui stackable buttons">
<a type="button" class="ui right floated button" href="{{ url_for('core.auth.login') }}">{{ _("I am not %(username)s", username=username) }}</a>
{% if features.has_smtp and features.has_password_recovery %}
<a type="button" class="ui right floated button" href="{{ url_for('core.auth.forgotten') }}">{{ _("Forgotten password") }}</a>
{% endif %}
<button type="submit" class="ui right floated primary button">{{ _("Sign in") }}</button>
{% block buttons %}
<div class="ui right aligned container">
<div class="ui stackable buttons">
<a type="button" class="ui right floated button" href="{{ url_for('core.auth.login') }}">{{ _("I am not %(username)s", username=username) }}</a>
{% if features.has_smtp and features.has_password_recovery %}
<a type="button" class="ui right floated button" href="{{ url_for('core.auth.forgotten') }}">{{ _("Forgotten password") }}</a>
{% endif %}
<button type="submit" class="ui right floated primary button">{{ _("Sign in") }}</button>
</div>
</div>
</div>
{% endblock %}
{% endcall %}
</div>
</div>
Expand Down

0 comments on commit 61da068

Please sign in to comment.