Skip to content

Commit

Permalink
Bootstrap 5 (#1089)
Browse files Browse the repository at this point in the history
* Update django bootstrap to v5

* Update load bootstrap tag

* Moves static HTML to web template directory

* Fix sonarcloud issues

* Bootstrap 5 my account (#1111)

* Changes to the login page to support BS5

* Add bootstrap icons package

* Add title to login view

* Move footer to its own file

* Clean up navigation bar html

* HTML update to home view

* Updates to FAQ accordion

* Updates to the studies list page

* Update scientists view

* Edit profile images to be no larger then 250px

* Updates to the resources view

* Updates to the my account views

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Changes to the login page to support BS5 (#1091)

* Bootstrap 5 studies history (#1112)

* HTML update to home view

* Update to the study history view

* Bootstrap 5 FAQ (#1103)

* Changes to the login page to support BS5

* HTML update to home view

* Bootstrap 5 exp manage studies (#1113)

* HTML update to home view

* Update to the study history view

* Updates to experimenter manage studies view

* fix problem with study description text running into date column

* fix center alignment of no studies found message

---------

Co-authored-by: Becky Gilbert <beckyannegilbert@gmail.com>

* Bootstrap 5 studies (#1124)

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Bootstrap 5 FAQ (#1103)

* Changes to the login page to support BS5

* HTML update to home view

* Changes to the login page to support BS5

* Clean up navigation bar html

* HTML update to home view

* Updates to FAQ accordion

* Updates to the studies list page

* Update researcher registration

* Update participant signup

* Replace bootstrap_icon is bs_icon to pass tests

* Update tests

* Bootstrap 5 exp view participants (#1116)

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Updates to experimenter manage studies view

* Updates to the support lookit view

* Updates to the participants list

* Add description to paraticipant table

* Add const to values in js

* Bootstrap 5 exp participant detail (#1118)

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Updates to the participant details view

* Add captions to tables

* Bootstrap 5 home (#1098) (#1114)

* Changes to the login page to support BS5

* HTML update to home view

* Bootstrap 5 resources (#1107)

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Bootstrap 5 FAQ (#1103)

* Changes to the login page to support BS5

* HTML update to home view

* Changes to the login page to support BS5

* Clean up navigation bar html

* HTML update to home view

* Updates to FAQ accordion

* Updates to the studies list page

* Update scientists view

* Updates to the resources view

* edit subheading size/spacing and content alignment

* Fixed linting error

---------

Co-authored-by: Becky Gilbert <beckyannegilbert@gmail.com>

* Bootstrap 5 scientists (#1105)

* Changes to the login page to support BS5

* Clean up navigation bar html

* HTML update to home view

* swap MKS pic

* add becky to scientists page

* reorder core team - alphabetical by last name

* Fixed linting error

---------

Co-authored-by: Becky Gilbert <beckyannegilbert@gmail.com>

* Bootstrap 5 exp study detail (#1121)

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Updates to experimenter manage studies view

* Return empty string when match is empty

* Remove span from paginator html

* Initial BS5 Update to exp study detail view

* Addition update for BS5

* Clean up study detail view

* add background color to study status items, fix color values for comments and build

---------

Co-authored-by: Becky Gilbert <beckyannegilbert@gmail.com>

* Bootstrap 5 studies history bug fix (#1119)

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Bootstrap 5 FAQ (#1103)

* Changes to the login page to support BS5

* HTML update to home view

* fix incorrect message when no history of Lookit/external studies

* Fixed linting error

---------

Co-authored-by: CJ Green <44074998+okaycj@users.noreply.github.com>

* Bootstrap 5 study edit/create (#1120)

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Bootstrap 5 FAQ (#1103)

* Changes to the login page to support BS5

* HTML update to home view

* update study edit to bootstrap 5

* replace custom help-block class with BS5 form-text where possible

* update save confirmation modal

* move JS from HTML to study-edit.js

* refactor to remove JS and CSS from templates

* fix typo

* update study create form for BS5

* fix issues with protocol generator content and display updating

* fix bug with study edit save confirmation

* fix linting errors

* Fix sonarcloud issues

* Fixed linting errors

* remove unnecessary message tags

---------

Co-authored-by: CJ Green <44074998+okaycj@users.noreply.github.com>

* Bootstrap 5 privacy, contact, terms of use (#1126)

* bs5 changes to privacy, terms of use, contact pages, and FAQ for consistency

* fixed linting errors

---------

Co-authored-by: CJ Green <44074998+okaycj@users.noreply.github.com>

* Bootstrap 5 exp responses consent ruling (#1125)

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Initial BS5 Update to exp study detail view

* Addition update for BS5

* Update repsonse consent ruling view

* fix formatting errors

---------

Co-authored-by: Becky Gilbert <beckyannegilbert@gmail.com>

* Fix sonarlint issues

* Update poetry lock

* Fix child info on participant detail view (#1134)

* Bootstrap 5 recipients email view (#1129)

* Bootstrap 5 my account (#1111)

* Changes to the login page to support BS5

* Add bootstrap icons package

* Add title to login view

* Move footer to its own file

* Clean up navigation bar html

* HTML update to home view

* Updates to FAQ accordion

* Updates to the studies list page

* Update scientists view

* Edit profile images to be no larger then 250px

* Updates to the resources view

* Updates to the my account views

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Bootstrap 5 FAQ (#1103)

* Changes to the login page to support BS5

* HTML update to home view

* Bootstrap 5 home (#1098) (#1114)

* Changes to the login page to support BS5

* HTML update to home view

* Update for bs5

* Fix sonar issues

* Fixed issue with duplicate code.

* Bootstrap 5 response views (#1132)

* bs5 changes to experimenter response views

* move JS to separate file

* add defer to script tag

* remove JS to set search value

* more consistent styling for no data messages

* add message for no response viewing permissions

* fix no data margins for consistency

* use colspan for full width cell instead of empty cells

* remove unnecessary head block

* Bootstrap 5 nav bar (#1115)

* Update django bootstrap to v5

* Update load bootstrap tag

* Moves static HTML to web template directory

* Fix sonarcloud issues

* Bootstrap 5 my account (#1111)

* Changes to the login page to support BS5

* Add bootstrap icons package

* Add title to login view

* Move footer to its own file

* Clean up navigation bar html

* HTML update to home view

* Updates to FAQ accordion

* Updates to the studies list page

* Update scientists view

* Edit profile images to be no larger then 250px

* Updates to the resources view

* Updates to the my account views

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Changes to the login page to support BS5 (#1091)

* Bootstrap 5 studies history (#1112)

* HTML update to home view

* Update to the study history view

* Bootstrap 5 FAQ (#1103)

* Changes to the login page to support BS5

* HTML update to home view

* Bootstrap 5 exp manage studies (#1113)

* HTML update to home view

* Update to the study history view

* Updates to experimenter manage studies view

* fix problem with study description text running into date column

* fix center alignment of no studies found message

---------

Co-authored-by: Becky Gilbert <beckyannegilbert@gmail.com>

* Bootstrap 5 studies (#1124)

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Bootstrap 5 FAQ (#1103)

* Changes to the login page to support BS5

* HTML update to home view

* Changes to the login page to support BS5

* Clean up navigation bar html

* HTML update to home view

* Updates to FAQ accordion

* Updates to the studies list page

* Update researcher registration

* Update participant signup

* Replace bootstrap_icon is bs_icon to pass tests

* Update tests

* Bootstrap 5 exp view participants (#1116)

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Updates to experimenter manage studies view

* Updates to the support lookit view

* Updates to the participants list

* Add description to paraticipant table

* Add const to values in js

* Bootstrap 5 exp participant detail (#1118)

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Updates to the participant details view

* Add captions to tables

* Bootstrap 5 home (#1098) (#1114)

* Changes to the login page to support BS5

* HTML update to home view

* Bootstrap 5 resources (#1107)

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Bootstrap 5 FAQ (#1103)

* Changes to the login page to support BS5

* HTML update to home view

* Changes to the login page to support BS5

* Clean up navigation bar html

* HTML update to home view

* Updates to FAQ accordion

* Updates to the studies list page

* Update scientists view

* Updates to the resources view

* edit subheading size/spacing and content alignment

* Fixed linting error

---------

Co-authored-by: Becky Gilbert <beckyannegilbert@gmail.com>

* Bootstrap 5 scientists (#1105)

* Changes to the login page to support BS5

* Clean up navigation bar html

* HTML update to home view

* swap MKS pic

* add becky to scientists page

* reorder core team - alphabetical by last name

* Fixed linting error

---------

Co-authored-by: Becky Gilbert <beckyannegilbert@gmail.com>

* Bootstrap 5 exp study detail (#1121)

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Updates to experimenter manage studies view

* Return empty string when match is empty

* Remove span from paginator html

* Initial BS5 Update to exp study detail view

* Addition update for BS5

* Clean up study detail view

* add background color to study status items, fix color values for comments and build

---------

Co-authored-by: Becky Gilbert <beckyannegilbert@gmail.com>

* Bootstrap 5 studies history bug fix (#1119)

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Bootstrap 5 FAQ (#1103)

* Changes to the login page to support BS5

* HTML update to home view

* fix incorrect message when no history of Lookit/external studies

* Fixed linting error

---------

Co-authored-by: CJ Green <44074998+okaycj@users.noreply.github.com>

* Bootstrap 5 study edit/create (#1120)

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* Bootstrap 5 FAQ (#1103)

* Changes to the login page to support BS5

* HTML update to home view

* update study edit to bootstrap 5

* replace custom help-block class with BS5 form-text where possible

* update save confirmation modal

* move JS from HTML to study-edit.js

* refactor to remove JS and CSS from templates

* fix typo

* update study create form for BS5

* fix issues with protocol generator content and display updating

* fix bug with study edit save confirmation

* fix linting errors

* Fix sonarcloud issues

* Fixed linting errors

* remove unnecessary message tags

---------

Co-authored-by: CJ Green <44074998+okaycj@users.noreply.github.com>

* Bootstrap 5 privacy, contact, terms of use (#1126)

* bs5 changes to privacy, terms of use, contact pages, and FAQ for consistency

* fixed linting errors

---------

Co-authored-by: CJ Green <44074998+okaycj@users.noreply.github.com>

* Bootstrap 5 home (#1098)

* Changes to the login page to support BS5

* HTML update to home view

* move from custom CSS to BS5 classes

* add classes as separate strings

* move repeated HTML into nav_link and nav_next template functions

* switch from nav lists to links and clean up extra markup

* move nav CSS into separate file in web/static/css and load in base.html

* fix formatting errors

* fix nav_link sonar error caused by merge conflict mistake

* fix linting

---------

Co-authored-by: CJ Green <44074998+okaycj@users.noreply.github.com>

* bs5 changes for 2fa setup view (#1137)

* Bootstrap 5  lab views (#1130)

* bs5 update for lab views

* Add cards to labs view

* add margin to no labs found message

---------

Co-authored-by: Becky Gilbert <beckyannegilbert@gmail.com>

* Bootstrap 5 experimenter nav bar (#1136)

* update exp navigation to match web, fix nav item spacing

* remove recruitment stats (analytics) from nav bar

* Update djlint (#1138)

* Update package

* Reformat html files

* Fix lint rule T002

* Move all js/css sources to base file

* Add form errors to forms

* Remove unneccessary footer includes

* Remove unused static files

* Fix sonarlint issues

* Mark font at important

---------

Co-authored-by: Becky Gilbert <beckyannegilbert@gmail.com>
  • Loading branch information
okaycj and becky-gilbert authored Mar 13, 2023
1 parent 47ffeff commit 403af83
Show file tree
Hide file tree
Showing 154 changed files with 6,981 additions and 10,533 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/Riverside-Healthcare/djLint
rev: 0.7.6
rev: v1.19.16
hooks:
- id: djlint-django
args: ['--profile', 'django', '--lint', '--reformat', '--quiet']
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,8 @@ local-certs:
mkcert -install
cd certs && mkcert local_lookit.mit.edu

media:
gsutil -m cp -r "gs://lookit-staging/media" ./project

test:
docker compose run --rm -e ENVIRONMENT= web poetry run ./manage.py test --failfast
2 changes: 1 addition & 1 deletion accounts/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ class StudyLocation(FormChoiceEnum):
study_list_tabs = forms.ChoiceField(
choices=Tabs.choices(),
initial=0,
widget=forms.RadioSelect(attrs={"class": "hidden"}),
widget=forms.RadioSelect(attrs={"class": "d-none"}),
required=False,
)
study_location = forms.ChoiceField(choices=StudyLocation.choices(), required=False)
Expand Down
58 changes: 33 additions & 25 deletions accounts/templates/accounts/2fa-setup.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,45 @@
{% extends "web/base.html" %}
{% load bootstrap3 %}
{% load django_bootstrap5 %}
{% load bootstrap_icons %}
{% load static %}
{% block head %}
{{ block.super }}
<link rel="stylesheet" href="{% static 'css/2fa-setup.css' %}"/>
{% endblock head %}
{% block title %}
Set up Two Factor Authentication
{% endblock title %}
{% block content %}
{% bootstrap_messages %}
<div class="container mt-lg">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">QR Code</h3>
</div>
<div id="qr-container" class="panel-body">
<div class="row">
<div class="col">
<div class="card bg-light my-4">
<div class="card-header">
<h3 class="card-title">QR Code</h3>
</div>
<div class="card-body row">
<div class="col d-flex ms-5 justify-content-end">
<ol>
<li>Open up the Google Authenticator App on your mobile device.</li>
<li>
Click on the <span class="glyphicon glyphicon-plus"></span> button on the right side of the top menu.
</li>
<li>Focus your phone camera on the QR code.</li>
<li>
<form method="post">
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_form form %}
{% bootstrap_button "Test Code" button_type="submit" button_class="btn-primary" %}
</form>
</li>
</ol>
<div>{{ svg_qr_code | safe }}</div>
<li class="my-3">Open up the Google Authenticator App on your mobile device.</li>
<li class="my-3">
Click on the
<span class="text-align-icon">{% bs_icon "plus-lg" size="1.5em" %}</span>
button on the right side of the top menu.
</li>
<li class="my-3">Focus your phone camera on the QR code.</li>
<li class="my-3">
<form method="post">
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_form form %}
{% bootstrap_button "Test Code" button_type="submit" button_class="btn-primary" %}
</form>
</li>
</ol>
</div>
<div class="col d-flex me-4 justify-content-center pt-5">{{ svg_qr_code | safe }}</div>
</div>
</div>
</div>
</div>
</div>
{% endblock content %}
68 changes: 38 additions & 30 deletions accounts/templates/accounts/_account-navigation.html
Original file line number Diff line number Diff line change
@@ -1,33 +1,41 @@
{% load i18n %}
<a class="{% if current_page == 'manage-account' %} active{% endif %} btn btn-default btn-md btn-block"
href="{% url 'accounts:manage-account' %}"><strong>{% trans "Account Information" %}</strong>
<br />
{% trans "Change your login credentials and/or nickname." %}</a>
<a class="{% if current_page == 'demographic-update' %} active{% endif %} btn btn-default btn-md btn-block"
href="{% url 'web:demographic-data-update' %}"><strong>{% trans "Demographic Survey" %}</strong>
<br />
{% trans "Tell us more about yourself." %}</a>
<a class="{% if current_page == 'children-list' %} active{% endif %} btn btn-default btn-md btn-block"
href="{% url 'web:children-list' %}"><strong>{% trans "Children Information" %}</strong>
<br />
{% trans "Add or edit participant information." %}</a>
{% if request.session.study_name %}
<a class="btn-has-study btn btn-default btn-md btn-block btn-primary{% if not has_study_child or not user.has_demographics %} disabled{% endif %}"
href="{% url 'web:study-detail' uuid=request.session.study_uuid %}"><strong>{% trans "Continue to Study" %}</strong>
<br />
{% trans "Go on to" %} "{{ request.session.study_name|truncatechars:40 }}".</a>
{% endif %}
<a class="btn-study-list btn btn-default btn-md btn-block {% if not request.session.study_name %}btn-primary{% endif %}{% if not user.has_any_child or not user.has_demographics %} disabled{% endif %}"
href="{% url 'web:studies-list' %}"><strong>
<div class="list-group">
<a class="{% if current_page == 'manage-account' %}active{% endif %} list-group-item"
href="{% url 'accounts:manage-account' %}">
<strong>{% trans "Account Information" %}</strong>
<br />
{% trans "Change your login credentials and/or nickname." %}</a>
<a class="{% if current_page == 'demographic-update' %}active{% endif %} list-group-item"
href="{% url 'web:demographic-data-update' %}">
<strong>{% trans "Demographic Survey" %}</strong>
<br />
{% trans "Tell us more about yourself." %}</a>
<a class="{% if current_page == 'children-list' %}active{% endif %} list-group-item"
href="{% url 'web:children-list' %}">
<strong>{% trans "Children Information" %}</strong>
<br />
{% trans "Add or edit participant information." %}</a>
{% if request.session.study_name %}
{% trans "Find Another Study" %}
{% else %}
{% trans "Find a Study Now" %}
<a class="btn-has-study list-group-item list-group-item-primary{% if not has_study_child or not user.has_demographics %} disabled{% endif %}"
href="{% url 'web:study-detail' uuid=request.session.study_uuid %}">
<strong>{% trans "Continue to Study" %}</strong>
<br />
{% trans "Go on to" %} "{{ request.session.study_name|truncatechars:40 }}".</a>
{% endif %}
</strong>
<br />
{% trans "See all available studies." %}</a>
<a class="{% if current_page == 'email-preferences' %} active{% endif %} btn btn-default btn-md btn-block"
href="{% url 'web:email-preferences' %}"><strong>{% trans "Email Preferences" %}</strong>
<br />
{% trans "Edit when you can be contacted." %}</a>
<a class="btn-study-list list-group-item {% if not request.session.study_name %}list-group-item-primary{% endif %}{% if not user.has_any_child or not user.has_demographics %} disabled{% endif %}"
href="{% url 'web:studies-list' %}">
<strong>
{% if request.session.study_name %}
{% trans "Find Another Study" %}
{% else %}
{% trans "Find a Study Now" %}
{% endif %}
</strong>
<br />
{% trans "See all available studies." %}</a>
<a class="{% if current_page == 'email-preferences' %}active{% endif %} list-group-item"
href="{% url 'web:email-preferences' %}">
<strong>{% trans "Email Preferences" %}</strong>
<br />
{% trans "Edit when you can be contacted." %}</a>
</div>
145 changes: 58 additions & 87 deletions accounts/templates/accounts/account-update.html
Original file line number Diff line number Diff line change
@@ -1,101 +1,72 @@
{% extends "web/base.html" %}
{% load bootstrap3 %}
{% load django_bootstrap5 %}
{% load i18n %}
{% block title %}
Update account information
{% trans "Update account information" %}
{% endblock title %}
{% load i18n %}
{% block flash %}
{% if form.non_field_errors %}<div class="alert alert-danger" role="alert">{{ form.non_field_errors }}</div>{% endif %}
{% endblock flash %}
{% block content %}
{% bootstrap_messages %}
<div class="container">
<div class="row account-edit">
<div class="col-md-4 mb-lg ">{% include 'accounts/_account-navigation.html' with current_page="manage-account" %}</div>
<div class="col-md-8">
<div class="panel-heading">
<h1 class="panel-title">{% trans "Account Information" %}</h1>
</div>
<div class="panel panel-default">
<div class="panel-body">
<form method="post">
{% csrf_token %}
{% bootstrap_form update_account_form %}
{% buttons %}
<div class="pull-right">
<button type="submit"
name="form-handle"
value="update-account"
class="btn btn-success">Save</button>
</div>
{% endbuttons %}
<div class="row">
<div class="col-4">{% include "accounts/_account-navigation.html" with current_page="manage-account" %}</div>
<div class="col-8">
{# Account information card #}
<div class="card mb-4">
<div class="card-body">
<h1 class="card-title">{% trans "Account Information" %}</h1>
<form method="post">
{% csrf_token %}
{% bootstrap_form_errors update_account_form %}
{% bootstrap_form update_account_form %}
{% bootstrap_button "Save" name="form-handle" value="update-account" %}
</form>
</div>
</div>
<div class="panel-heading">
<h1 class="panel-title">{% trans "Change Your Password" %}</h1>
</div>
<div class="panel panel-default">
<div class="panel-body">
{# Change password card #}
<div class="card mb-4">
<div class="card-body">
<h1 class="card-title">{% trans "Change Your Password" %}</h1>
<form method="post">
{% csrf_token %}
{% bootstrap_form_errors change_password_form %}
{% bootstrap_form change_password_form %}
{% buttons %}
<div class="pull-right">
<button name="form-handle"
value="change-password"
type="submit"
class="btn btn-success">Save</button>
</div>
{% endbuttons %}
</form>
</div>
</div>
{# Only show 2FA management panel for researchers #}
{% if request.user.is_researcher %}
<div class="panel-heading">
<h1 class="panel-title">{% trans "Manage Two-Factor Authentication" %}</h1>
</div>
<div class="panel panel-default">
<div class="panel-body">
{% if otp %}
{% comment %}
If we have OTP, enable setup completion in the case where it's not yet
activated, and allow reset with verified OTP if it is.
{% endcomment %}
<form method="post">
{% csrf_token %}
{% if otp.activated %}
{# enable reset of OTP #}
<p>
{% trans "If you'd like, you can turn two-factor authentication off here. Just enter your one-time password here, hit submit, and it'll get deleted for you!" %}
</p>
{% else %}
<div class="col-md-4">{{ otp.get_svg_qr_code | safe }}</div>
<p>
{% trans "It looks like you were in the middle of setting up two factor authentication, but didn't complete the process. You can capture the QR code here, verify with a one-time password, and finish the process." %}
</p>
{% endif %}
{% bootstrap_form otp_check_form %}
{% buttons %}
<div class="pull-right">
<button name="form-handle"
value="{% if otp.activated %}de{% endif %}activate-otp"
type="submit"
class="btn btn-success">
Submit
</button>
</div>
{% endbuttons %}
{% bootstrap_button "Save" name="form-handle" value="change-password" %}
</form>
{% else %}
{# if we don't have OTP, link to 2FA setup directly. #}
<a href="{% url "accounts:2fa-setup" %}">{% trans "Set up Two-Factor Authentication" %}</a>
{% endif %}
</div>
</div>
{% if request.user.is_researcher %}
{# 2FA card #}
<div class="card mb-4">
<div class="card-body">
<h1 class="card-title">{% trans "Manage Two-Factor Authentication" %}</h1>
{% if otp %}
{# If we have OTP, enable setup completion in the case where it's not yet activated, and allow reset with verified OTP if it is. #}
<form method="post">
{% if otp.activated %}
{# enable reset of OTP #}
<p>
{% trans "If you'd like, you can turn two-factor authentication off here. Just enter your one-time password here, hit submit, and it'll get deleted for you!" %}
</p>
{% else %}
<div class="col-md-4">{{ otp.get_svg_qr_code | safe }}</div>
<p>
{% trans "It looks like you were in the middle of setting up two factor authentication, but didn't complete the process. You can capture the QR code here, verify with a one-time password, and finish the process." %}
</p>
{% endif %}
{% csrf_token %}
{% bootstrap_form_errors otp_check_form %}
{% bootstrap_form otp_check_form %}
{% if otp.activated %}
{% bootstrap_button "Submit" name="form-handle" value="deactivate-otp" %}
{% else %}
{% bootstrap_button "Submit" name="form-handle" value="activate-otp" %}
{% endif %}
</form>
{% else %}
{# if we don't have OTP, link to 2FA setup directly. #}
<a href="{% url "accounts:2fa-setup" %}">{% trans "Set up Two-Factor Authentication" %}</a>
{% endif %}
</div>
</div>
{% endif %}
</div>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock content %}
Loading

0 comments on commit 403af83

Please sign in to comment.