Skip to content
Snippets Groups Projects
Commit f36dd867 authored by sandeepsajan0's avatar sandeepsajan0 Committed by Fredrik Jonsson
Browse files

Update Acount page and put enable/diable buttons on account page itself

parent f1c1afb5
No related branches found
No related tags found
No related merge requests found
{% extends "two_factor/_base_focus.html" %}
{% load i18n %}
{% block content %}
<h1>{% block title %}{% trans "Enable Two-Factor Authentication" %}{% endblock %}</h1>
{% if wizard.steps.current == 'welcome' %}
<p>{% blocktrans trimmed %}You are about to take your account security to the
next level. Follow the steps in this wizard to enable two-factor
authentication.{% endblocktrans %}</p>
{% elif wizard.steps.current == 'method' %}
<p>{% blocktrans trimmed %}Please select which authentication method you would
like to use.{% endblocktrans %}</p>
{% elif wizard.steps.current == 'generator' %}
<p>{% blocktrans trimmed %}To start using a token generator, please use your
smartphone to scan the QR code below. For example, use Google
Authenticator. Then, enter the token generated by the app.
{% endblocktrans %}</p>
<p><img src="{{ QR_URL }}" alt="QR Code" /></p>
{% elif wizard.steps.current == 'sms' %}
<p>{% blocktrans trimmed %}Please enter the phone number you wish to receive the
text messages on. This number will be validated in the next step.
{% endblocktrans %}</p>
{% elif wizard.steps.current == 'call' %}
<p>{% blocktrans trimmed %}Please enter the phone number you wish to be called on.
This number will be validated in the next step. {% endblocktrans %}</p>
{% elif wizard.steps.current == 'validation' %}
{% if challenge_succeeded %}
{% if device.method == 'call' %}
<p>{% blocktrans trimmed %}We are calling your phone right now, please enter the
digits you hear.{% endblocktrans %}</p>
{% elif device.method == 'sms' %}
<p>{% blocktrans trimmed %}We sent you a text message, please enter the tokens we
sent.{% endblocktrans %}</p>
{% endif %}
{% else %}
<p class="alert alert-warning" role="alert">{% blocktrans trimmed %}We've
encountered an issue with the selected authentication method. Please
go back and verify that you entered your information correctly, try
again, or use a different authentication method instead. If the issue
persists, contact the site administrator.{% endblocktrans %}</p>
{% endif %}
{% elif wizard.steps.current == 'yubikey' %}
<p>{% blocktrans trimmed %}To identify and verify your YubiKey, please insert a
token in the field below. Your YubiKey will be linked to your
account.{% endblocktrans %}</p>
{% endif %}
<form action="" method="post">{% csrf_token %}
{% include "two_factor/_wizard_forms.html" %}
{# hidden submit button to enable [enter] key #}
<input type="submit" value="" class="d-none" />
{% include "two_factor/_wizard_actions.html" %}
</form>
{% endblock %}
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
{% block title %}Account{% endblock %} {% block title %}Account{% endblock %}
{% block content %} {% block content %}
<div class="admin-bar"> <div class="admin-bar" xmlns="http://www.w3.org/1999/html">
<div class="admin-bar__inner admin-bar__inner--with-button"> <div class="admin-bar__inner admin-bar__inner--with-button">
<h3 class="admin-bar__heading">{% trans "Welcome" %} {{ user }}</h3> <h3 class="admin-bar__heading">{% trans "Welcome" %} {{ user }}</h3>
<a href="{% url 'dashboard:dashboard' %}" class="button button--primary button--arrow-pixels-white"> <a href="{% url 'dashboard:dashboard' %}" class="button button--primary button--arrow-pixels-white">
...@@ -24,17 +24,27 @@ ...@@ -24,17 +24,27 @@
{% endfor %} {% endfor %}
<button class="button button--primary" type="submit">{% trans "Update Profile" %}</button> <button class="button button--primary" type="submit">{% trans "Update Profile" %}</button>
</form> </form>
</div> <!-- </div>-->
{% if show_change_password and user.has_usable_password and not backends.associated %} {% if show_change_password and user.has_usable_password and not backends.associated %}
<div class="profile__column"> <br>
<hr>
<!-- <div class="profile__column">-->
<h3>{% trans "Change password" %}</h3> <h3>{% trans "Change password" %}</h3>
<p><a class="button button--primary" href="{% url 'users:password_change' %}">{% trans "Update password" %}</a></p> <p><a class="button button--primary" href="{% url 'users:password_change' %}">{% trans "Update password" %}</a></p>
<h3>{% trans "Account security" %}</h3> <h3>{% trans "Account security" %}</h3>
<p><a class="link link--button link--button--narrow" href="{% url 'two_factor:profile' %}">{% trans "Two-factor authentication settings" %}</a></p> {% if default_device %}
</div> <div>
{% endif %} <p><a class="link link--button link--button--narrow" href="{% url 'users:backup_tokens_password' %}">{% trans "Show Codes" %}</a></p>
<p><a class="link link--button link--button--narrow" href="{% url 'two_factor:disable' %}">{% trans "Disable 2FA" %}</a></p>
</div>
{% else %}
<p><a class="link link--button link--button--narrow" href="{% url 'two_factor:setup' %}">{% trans "Enable 2FA" %}</a></p>
{% endif %}
{% endif %}
</div>
<div class="profile__column"> <div class="profile__column">
{% if swappable_form %} {% if swappable_form %}
......
...@@ -24,6 +24,7 @@ from hijack.views import AcquireUserView ...@@ -24,6 +24,7 @@ from hijack.views import AcquireUserView
from two_factor.forms import AuthenticationTokenForm, BackupTokenForm from two_factor.forms import AuthenticationTokenForm, BackupTokenForm
from two_factor.views import DisableView as TwoFactorDisableView from two_factor.views import DisableView as TwoFactorDisableView
from two_factor.views import LoginView as TwoFactorLoginView from two_factor.views import LoginView as TwoFactorLoginView
from two_factor.utils import default_device
from wagtail.admin.views.account import password_management_enabled from wagtail.admin.views.account import password_management_enabled
from wagtail.core.models import Site from wagtail.core.models import Site
from wagtail.users.views.users import change_user_perm from wagtail.users.views.users import change_user_perm
...@@ -100,6 +101,7 @@ class AccountView(UpdateView): ...@@ -100,6 +101,7 @@ class AccountView(UpdateView):
return super().get_context_data( return super().get_context_data(
swappable_form=swappable_form, swappable_form=swappable_form,
default_device=default_device(self.request.user),
show_change_password=show_change_password, show_change_password=show_change_password,
**kwargs, **kwargs,
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment