Skip to content

Commit

Permalink
Fix registration views (#1152)
Browse files Browse the repository at this point in the history
* Update registration view for BS5

* Remove duplicate form error messages
  • Loading branch information
okaycj authored Mar 24, 2023
1 parent fec9a52 commit 8f7e4f4
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 101 deletions.
1 change: 0 additions & 1 deletion accounts/templates/accounts/2fa-setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ <h3 class="card-title">QR Code</h3>
<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_classes %}
</form>
Expand Down
3 changes: 0 additions & 3 deletions accounts/templates/accounts/account-update.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<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>
Expand All @@ -26,7 +25,6 @@ <h1 class="card-title">{% trans "Account Information" %}</h1>
<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 %}
{% bootstrap_button "Save" name="form-handle" value="change-password" %}
</form>
Expand All @@ -52,7 +50,6 @@ <h1 class="card-title">{% trans "Manage Two-Factor Authentication" %}</h1>
</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" %}
Expand Down
1 change: 0 additions & 1 deletion accounts/templates/accounts/researcher-registration.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<div class="card-body">
<form method="post" action="">
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_form form %}
<p>
By clicking 'Create Account', you agree that you have read and accepted the
Expand Down
1 change: 0 additions & 1 deletion studies/templates/studies/lab_create.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<h1>Create Lab</h1>
<form action="" enctype="multipart/form-data" method="post">
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_form form %}
{% bootstrap_button "Submit" %}
</form>
Expand Down
1 change: 0 additions & 1 deletion studies/templates/studies/lab_update.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<h1>Update Lab</h1>
<form action="" enctype="multipart/form-data" method="post">
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_form form %}
{% bootstrap_button "Discard Changes" href=url_lab_edit button_class=btn_secondary_classes %}
{% bootstrap_button "Save" type="submit" button_class=btn_primary_classes %}
Expand Down
1 change: 0 additions & 1 deletion studies/templates/studies/study_participant_contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@
</div>
<form method="post">
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_form form %}
{% bootstrap_button "Submit" %}
</form>
Expand Down
1 change: 0 additions & 1 deletion web/templates/registration/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<div class="card-body">
<form action="" method="post" autocomplete="off">
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_form form %}
{% bootstrap_button button_type="submit" content=login %}
<input type="hidden" name="next" value="{{ next }}" />
Expand Down
20 changes: 7 additions & 13 deletions web/templates/registration/password_reset_complete.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@
{% load bootstrap_icons %}
{% load web_extras %}
{% block content %}
<div class="container">
<div class="pt-lg col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1 col-xs-12 col-xs-offset-0">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{% trans "Password reset complete" %}</h3>
</div>
<div class="panel-body">
<p>{% trans "Your password has been set. You may go ahead and log in now." %}</p>
<p>
<a href="{{ login_url }}" class="{% button_primary_classes %}">{% bs_icon "user" %} {% trans "Log in" %}</a>
</p>
</div>
</div>
{% bs_icon "person-circle" as bs_icon_person %}
{% trans "Log in" as trans_login %}
<div class="card">
<div class="card-header">{% trans "Password reset complete" %}</div>
<div class="card-body">
<p>{% trans "Your password has been set. You may go ahead and log in now." %}</p>
<p>{% bootstrap_button bs_icon_person|add:trans_login href=login_url %}</p>
</div>
</div>
{% endblock content %}
50 changes: 16 additions & 34 deletions web/templates/registration/password_reset_confirm.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,22 @@
{% load django_bootstrap5 %}
{% load web_extras %}
{% block content %}
<div class="container app-password-reset">
<div class="pt-lg col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1 col-xs-12 col-xs-offset-0">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{% trans "Password reset confirmation" %}</h3>
</div>
<div class="panel-body">
{% if validlink %}
<p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p>
<form method="post">
{% csrf_token %}
<fieldset class="module aligned">
<div class="form-row field-password1">
{{ form.new_password1.errors }}
<label for="id_new_password1">{% trans "New password:" %}</label>
{{ form.new_password1 }}
</div>
<div class="form-row field-password2">
{{ form.new_password2.errors }}
<label for="id_new_password2">{% trans "Confirm password:" %}</label>
{{ form.new_password2 }}
</div>
<input type="submit"
class="{% button_primary_classes %}"
value="{% trans "Change my password" %}"/>
</fieldset>
</form>
{% else %}
<p>
{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}
</p>
{% endif %}
</div>
</div>
{% trans "Change my password" as trans_change_my_password %}
<div class="card">
<div class="card-header">{% trans "Password reset confirmation" %}</div>
<div class="card-body">
{% if validlink %}
<p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p>
<form method="post">
{% csrf_token %}
{% bootstrap_form form %}
{% bootstrap_button trans_change_my_password %}
</form>
{% else %}
<p>
{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}
</p>
{% endif %}
</div>
</div>
{% endblock content %}
24 changes: 9 additions & 15 deletions web/templates/registration/password_reset_done.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,15 @@
{% load i18n static %}
{% load django_bootstrap5 %}
{% block content %}
<div class="container">
<div class="pt-lg col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1 col-xs-12 col-xs-offset-0">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{% trans "Password reset link sent" %}</h3>
</div>
<div class="panel-body">
<p>
{% trans "If an account exists with the email you entered, we've emailed instructions for resetting your password and you should receive them shortly." %}
</p>
<p>
{% trans "If you don't receive an email, please check your spam folder and make sure you've entered the address you registered with. (You won't get an email unless there's already an account for that email address!)" %}
</p>
</div>
</div>
<div class="card">
<div class="card-header">{% trans "Password reset link sent" %}</div>
<div class="card-body">
<p>
{% trans "If an account exists with the email you entered, we've emailed instructions for resetting your password and you should receive them shortly." %}
</p>
<p>
{% trans "If you don't receive an email, please check your spam folder and make sure you've entered the address you registered with. (You won't get an email unless there's already an account for that email address!)" %}
</p>
</div>
</div>
{% endblock content %}
37 changes: 12 additions & 25 deletions web/templates/registration/password_reset_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,18 @@
{% load django_bootstrap5 %}
{% load web_extras %}
{% block content %}
<div class="container app-password-reset">
<div class="pt-lg col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1 col-xs-12 col-xs-offset-0">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{% trans "Password reset" %}</h3>
</div>
<div class="panel-body">
<p>
{% trans "Forgotten your password? Enter your email address below, and we'll email instructions for setting a new one." %}
</p>
<form method="post">
{% csrf_token %}
<fieldset class="module aligned">
<div class="form-row field-email">
{{ form.email.errors }}
<label for="id_email">{% trans "Email address:" %}</label>
{{ form.email }}
</div>
<input type="submit"
class="{% button_primary_classes %}"
value="{% trans "Reset my password" %}"/>
</fieldset>
</form>
</div>
</div>
{% trans "Reset my password" as trans_reset_password %}
<div class="card">
<div class="card-header">{% trans "Password reset" %}</div>
<div class="card-body">
<p>
{% trans "Forgotten your password? Enter your email address below, and we'll email instructions for setting a new one." %}
</p>
<form method="post">
{% csrf_token %}
{% bootstrap_form form %}
{% bootstrap_button trans_reset_password %}
</form>
</div>
</div>
{% endblock content %}
1 change: 0 additions & 1 deletion web/templates/web/child-add.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
<h1 class="card-title">{% trans "Add Child" %}</h1>
<form method="post" action="">
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_form form %}
{% bootstrap_button trans_cancel href=url_children_list button_class=btn_secondary_classes %}
{% bootstrap_button bs_icon_plus|add:trans_add_child button_class=btn_primary_classes %}
Expand Down
1 change: 0 additions & 1 deletion web/templates/web/child-update.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
<h1 class="card-title">{% trans "Update" %} {{ child.given_name }}</h1>
<form method="post" action="">
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_form form %}
{% bootstrap_button trans_delete button_class="btn-danger" name="deleteChild" %}
{% bootstrap_button trans_cancel href=url_children_list button_class=btn_secondary_classes %}
Expand Down
1 change: 0 additions & 1 deletion web/templates/web/demographic-data-update.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
{% endif %}
<form method="post" action="">
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_form form %}
{% bootstrap_button trans_save %}
</form>
Expand Down
1 change: 0 additions & 1 deletion web/templates/web/participant-email-preferences.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<h1 class="card-title">{% trans "I would like to be contacted when:" %}</h1>
<form method="post" action="">
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_form form %}
{% bootstrap_button trans_cancel href=url_email_prefs button_class=btn_secondary_classes %}
{% bootstrap_button trans_save name="password_update" button_class=btn_primary_classes %}
Expand Down
1 change: 0 additions & 1 deletion web/templates/web/participant-signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
</div>
<form method="post" action="">
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_form form %}
<p>
{% trans "By clicking 'Create Account', I agree that I have read and accepted the " %} <a href="{% url 'web:privacy' %}" target="_blank" rel="noopener">{% trans "Privacy Statement" %}.</a>
Expand Down

0 comments on commit 8f7e4f4

Please sign in to comment.