Skip to content

Commit

Permalink
Fix login page design when 2FA is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Augustin-FL committed Dec 24, 2024
1 parent f2b2c35 commit 8e28bc1
Showing 1 changed file with 61 additions and 55 deletions.
116 changes: 61 additions & 55 deletions fir_auth_2fa/templates/two_factor/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,70 +7,76 @@

{% if wizard.steps.current == 'auth' %}
<div class="container">
<div class="col-sm-4 col-sm-offset-4 col-xs-12 col-xs-offset-0">
<form class="form-signin" method="post"> {% csrf_token %}
{{ wizard.management_form }}
<img class="img-responsive" src="{% static "img/logo.jpg" %}" alt="Logo" />
<h2 class="form-signin-heading">{% trans "Sign in to FIR" %}</h2>
<fieldset>
{% for field in form %}
{% if field|is_checkbox %}
<div class="checkbox">
<label>
<div class="row justify-content-md-center">
<div class="col-sm-5 col-sm-offset-4 col-xs-12 col-xs-offset-0">
<form class="form-signin p-4" method="post"> {% csrf_token %}
{{ wizard.management_form }}
<img class="img-responsive img-fluid" src="{% static "img/logo.jpg" %}" alt="Logo" />
<h2 class="form-signin-heading">{% trans "Sign in to FIR" %}</h2>
<fieldset>
{% for field in form %}
{% if field|is_checkbox %}
<div class="checkbox">
<label>
{{ field }}
{{ field.label }}
</label>
</div>
{% else %}
<div class="form-group mb-3">
{{ field }}
{{ field.label }}
</label>
</div>
{% else %}
<div class="form-group mb-3">
{{ field }}
{% if field.help_text %}
<p class="help-inline"><small>{{ field.help_text }}</small></p>
{% if field.help_text %}
<p class="help-inline"><small>{{ field.help_text }}</small></p>
{% endif %}
</div>
{% endif %}
{% endfor %}
</fieldset>
<div class="form-actions">
<button type="submit" class="btn btn-primary">{% trans "Submit" %}</button>
</div>
{% endif %}
{% endfor %}
</fieldset>
<div class="form-actions">
<button type="submit" class="btn btn-primary" >Submit</button>
</form>
{% if form.errors %}
<div class="alert alert-warning alert-dismissible">
{% for error in form.non_field_errors %}
{{ error }}
{% endfor %}
</div>
</form>
{% if form.errors %}
<div class="alert alert-warning alert-dismissible">
{% for error in form.non_field_errors %}
{{ error }}
{% endfor %}
</div>
{% endif %}
{% endif %}
</div>
</div>
</div>

{% elif wizard.steps.current == 'token' %}
<div class="container">
<div class="col-sm-4 col-sm-offset-4 col-xs-12 col-xs-offset-0">
<form class="form-signin" method="post"> {% csrf_token %}
<img class="img-responsive" src="{% static "img/logo.jpg" %}" alt="Logo" />
<h2 class="form-signin-heading"></h2>
<h2>Please enter the token generated by your token generator.</h2>
{{ wizard.management_form }}
<div class="form-group mb-3">
{{ wizard.form }}
</div>
{% if cancel_url %}
<a href="{{ cancel_url }}"
class="pull-right btn btn-link">{% trans "Cancel" %}</a>
{% endif %}
{% if wizard.steps.prev %}
<button name="wizard_goto_step" type="button"
value="{{ wizard.steps.prev }}"
class="btn btn-default">{% trans "Back" %}</button>
{% else %}
<button disabled name="" type="button"
class="btn btn-disabled">{% trans "Back" %}</button>
{% endif %}
<button type="submit" class="btn btn-primary">{% trans "Next" %}</button>

</div>
<div class="row justify-content-md-center">
<div class="col-sm-4 col-sm-offset-4 col-xs-12 col-xs-offset-0">
<form class="form-signin p-4" method="post"> {% csrf_token %}
<img class="img-responsive img-fluid" src="{% static "img/logo.jpg" %}" alt="Logo" />
<h2 class="form-signin-heading"></h2>
{{ wizard.management_form }}
<fieldset>
<h2>Please enter the token generated by your token generator.</h2>
<div class="form-group mb-3">
{{ wizard.form }}
</div>
</fieldset>
{% if cancel_url %}
<a href="{{ cancel_url }}"
class="pull-right btn btn-link">{% trans "Cancel" %}</a>
{% endif %}
{% if wizard.steps.prev %}
<button name="wizard_goto_step" type="button"
value="{{ wizard.steps.prev }}"
class="btn btn-default">{% trans "Back" %}</button>
{% else %}
<button disabled name="" type="button"
class="btn btn-disabled">{% trans "Back" %}</button>
{% endif %}
<button type="submit" class="btn btn-primary">{% trans "Next" %}</button>

</div>
</div>
</div>
{% endif %}

Expand Down

0 comments on commit 8e28bc1

Please sign in to comment.