Allow platform admins to change user auth in the UI

So we do not have to go into the db when we need to change user
auth.

We do not allow this for users who use webauthn. We do not want to
enable security downgrade for those users.
This commit is contained in:
Pea Tyczynska
2022-02-23 19:57:27 +00:00
committed by Leo Hemsted
parent 8da8b167c9
commit 08f0393553
7 changed files with 175 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
{% extends "views/platform-admin/_base_template.html" %}
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/form.html" import form_wrapper %}
{% from "components/back-link/macro.njk" import govukBackLink %}
{% block per_page_title %}
Set auth type for {{ user.name }}
{% endblock %}
{% block backLink %}
{{ govukBackLink({ "href": url_for('main.user_information', user_id=user.id) }) }}
{% endblock %}
{% block platform_admin_content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-five-sixths">
{{ page_header('Set auth type for ' + user.name) }}
{% call form_wrapper() %}
{{ form.auth_type }}
{{ page_footer('Save') }}
{% endcall %}
</div>
</div>
{% endblock %}

View File

@@ -13,6 +13,7 @@
</h1>
<p class="govuk-body">{{ user.email_address }}</p>
<p class="{{ '' if user.mobile_number else 'hint' }}">{{ user.mobile_number or 'No mobile number'}}</p>
<h2 class="heading-medium">Live services</h2>
<nav class="browse-list">
{% if user.live_services %}
@@ -45,6 +46,15 @@
</p>
{% endif %}
</nav>
<h2 class="heading-medium">Authentication</h2>
<p class="govuk-body">{{ user.auth_type }}</p>
{% if user.auth_type != 'webauthn_auth' %}
<a class="govuk-link govuk-link" href="{{ url_for('main.change_user_auth', user_id=user.id) }}">
Change authentication for this user
</a>
{% endif %}
<h2 class="heading-medium">Last login</h2>
{% if not user.logged_in_at %}
<p class="hint">This person has never logged in</p>