aboutsummaryrefslogtreecommitdiffstats
path: root/templates/web/base/auth
diff options
context:
space:
mode:
Diffstat (limited to 'templates/web/base/auth')
-rw-r--r--templates/web/base/auth/2faform.html26
-rw-r--r--templates/web/base/auth/change_password.html20
-rw-r--r--templates/web/base/auth/change_phone.html2
-rw-r--r--templates/web/base/auth/general.html12
-rw-r--r--templates/web/base/auth/generate_token.html26
5 files changed, 78 insertions, 8 deletions
diff --git a/templates/web/base/auth/2faform.html b/templates/web/base/auth/2faform.html
new file mode 100644
index 000000000..bd8d60cdb
--- /dev/null
+++ b/templates/web/base/auth/2faform.html
@@ -0,0 +1,26 @@
+[% INCLUDE 'header.html', bodyclass = 'fullwidthpage', title = loc('Confirm account') %]
+
+ <div class="confirmation-header confirmation-header--phone">
+ [% IF incorrect_code %]
+ <h1>[% loc('Sorry, that wasn&rsquo;t the correct code') %]</h1>
+ <p>[% loc('Try again') %]:</p>
+ [% ELSE %]
+ <h1>[% loc("Nearly done! Now check your phone&hellip;") %]</h1>
+ <p>[% loc("Please generate a two-factor code and enter it below:") %]</p>
+ [% END %]
+ <form action="/auth" method="post">
+ <input type="hidden" name="username" value="[% c.get_param('username') | html %]">
+ <input type="hidden" name="password_sign_in" value="[% c.get_param('password_sign_in') | html %]">
+ <input type="hidden" name="r" value="[% c.get_param('r') | html %]">
+ <input type="hidden" name="remember_me" value="[% c.get_param('remember_me') | html %]">
+ <input type="hidden" name="token" value="[% token | html %]">
+
+ <label for="2fa_code">[% loc('Code') %]</label>
+ <div class="form-txt-submit-box">
+ <input class="form-control" type="number" id="2fa_code" name="2fa_code" value="" required>
+ <input type="submit" value="[% loc('Submit') %]" class="btn-primary">
+ </div>
+ </form>
+ </div>
+
+[% INCLUDE 'footer.html' %]
diff --git a/templates/web/base/auth/change_password.html b/templates/web/base/auth/change_password.html
index a32dbaf9c..7a38e0134 100644
--- a/templates/web/base/auth/change_password.html
+++ b/templates/web/base/auth/change_password.html
@@ -1,7 +1,9 @@
[%
SET bclass = 'authpage';
SET bclass = 'fullwidthpage' IF password_changed;
-INCLUDE 'header.html', title = loc('Change password'), bodyclass = bclass
+SET title = loc('Set password');
+SET title = loc('Change password') IF c.user.password;
+INCLUDE 'header.html', title = title bodyclass = bclass
%]
[% IF password_changed %]
@@ -13,13 +15,15 @@ INCLUDE 'header.html', title = loc('Change password'), bodyclass = bclass
[% ELSE %]
-<h1>[% loc('Change password') %]</h1>
+<h1>[% title %]</h1>
<form action="[% c.uri_for_action('/auth/profile/change_password') %]" method="post" name="change_password" class="fieldset">
<input type="hidden" name="token" value="[% csrf_token %]">
<fieldset>
- [% IF password_error;
+ [% IF password_error == 'failed' %]
+ <div class="form-error">[% field_errors.password_register %]</div>
+ [% ELSIF password_error;
errors = {
missing => loc('Please enter a password'),
@@ -31,6 +35,14 @@ INCLUDE 'header.html', title = loc('Change password'), bodyclass = bclass
<div class="form-error">[% loc_password_error %]</div>
[% END %]
+[% IF c.user.password %]
+ <div class="form-field">
+ <label for="current_password">[% loc('Current password:') %]</label>
+ <input class="form-control" type="password" name="current_password" value="[% current_password | html %]">
+ </div>
+ <hr>
+[% END %]
+
<div class="form-field">
<label for="new_password">[% loc('New password:') %]</label>
<input class="form-control" type="password" name="new_password" value="[% new_password | html %]">
@@ -40,7 +52,7 @@ INCLUDE 'header.html', title = loc('Change password'), bodyclass = bclass
<input class="form-control" type="password" name="confirm" value="[% confirm | html %]">
</div>
<div class="final-submit">
- <input type="submit" class="btn" value="[% loc('Change password') %]">
+ <input type="submit" class="btn" value="[% title %]">
</div>
</fieldset>
diff --git a/templates/web/base/auth/change_phone.html b/templates/web/base/auth/change_phone.html
index 27a2f63dd..62e9fa6d6 100644
--- a/templates/web/base/auth/change_phone.html
+++ b/templates/web/base/auth/change_phone.html
@@ -18,7 +18,7 @@ END
[% IF c.user.phone_verified OR (c.user.phone AND NOT verifying) %]
[% loc('Your phone number') %]: [% c.user.phone_display %]
[% ELSIF c.user.phone %]
-[% DEFAULT username = c.user.phone %]
+[% DEFAULT username = c.user.phone_display %]
[% END %]
<form method="post" name="change_phone">
diff --git a/templates/web/base/auth/general.html b/templates/web/base/auth/general.html
index 8fc5578c1..1e44bb68e 100644
--- a/templates/web/base/auth/general.html
+++ b/templates/web/base/auth/general.html
@@ -60,7 +60,9 @@
[% INCLUDE form_sign_in_yes %]
<input type="hidden" name="oauth_need_email" value="1">
[% ELSE %]
+ [% IF NOT field_errors.password_register %]
[% INCLUDE form_sign_in_yes %]
+ [% END %]
[% INCLUDE form_sign_in_no %]
[% END %]
</div>
@@ -114,14 +116,22 @@
<input class="form-control" type="text" name="name" value="" placeholder="[% loc('Your name') %]">
<label for="password_register">[% loc('Password (optional)') %]</label>
+ [% IF field_errors.password_register %]
+ <p class='form-error'>[% field_errors.password_register %]</p>
+ [% END %]
<div class="general-notes">
<p>[% loc('Providing a name and password is optional, but doing so will allow you to more easily report problems, leave updates and manage your reports.') %]</p>
</div>
<div class="form-txt-submit-box">
- <input class="form-control" type="password" name="password_register" id="password_register" value="" placeholder="[% loc('Enter a password') %]">
+ <input class="form-control js-password-validate" type="password" name="password_register" id="password_register" value="" placeholder="[% loc('Enter a password') %]">
<input class="green-btn" type="submit" name="sign_in_by_code" value="[% loc('Sign in') %]">
</div>
+
+ <div class="general-notes">
+ <p>[% tprintf(loc('Your password should include %d or more characters.'), c.cobrand.password_minimum_length) %]</p>
+ </div>
+
</div>
[% END %]
diff --git a/templates/web/base/auth/generate_token.html b/templates/web/base/auth/generate_token.html
index 157335047..f7061be45 100644
--- a/templates/web/base/auth/generate_token.html
+++ b/templates/web/base/auth/generate_token.html
@@ -1,5 +1,5 @@
[%
-INCLUDE 'header.html', title = loc('Generate token'), bodyclass = 'fullwidthpage'
+INCLUDE 'header.html', title = loc('Security'), bodyclass = 'fullwidthpage'
%]
[% IF token_generated %]
@@ -15,9 +15,28 @@ INCLUDE 'header.html', title = loc('Generate token'), bodyclass = 'fullwidthpage
<p><a href="/my">[% loc('Your account') %]</a></p>
</div>
+[% ELSIF toggle_2fa_on %]
+
+ <div class="confirmation-header">
+ <h1>[% loc('Two-factor authentication has been activated') %]</h1>
+
+ <p align="center"><img src="[% qr_code %]"></p>
+ <p align="center">[% secret32.replace('(....)', '$1 ') %]</p>
+
+ <p><a href="/my">[% loc('Your account') %]</a></p>
+ </div>
+
+[% ELSIF toggle_2fa_off %]
+
+ <div class="confirmation-header">
+ <h1>[% loc('Two-factor authentication has been deactivated') %]</h1>
+
+ <p><a href="/my">[% loc('Your account') %]</a></p>
+ </div>
+
[% ELSE %]
-<h1>[% loc('Generate token') %]</h1>
+<h1>[% loc('Security') %]</h1>
<form action="[% c.uri_for_action('/auth/profile/generate_token') %]" method="post" name="generate_token">
<input type="hidden" name="token" value="[% csrf_token %]">
@@ -31,6 +50,9 @@ INCLUDE 'header.html', title = loc('Generate token'), bodyclass = 'fullwidthpage
<p>
<input name="generate_token" type="submit" class="btn" value="[% existing_token ? loc('Replace token') : loc('Generate token') %]">
+ [% IF c.user.is_superuser %]
+ <input name="toggle_2fa" type="submit" class="btn" value="[% has_2fa ? loc('Deactivate two-factor authentication') : loc('Activate two-factor authentication') %]">
+ [% END %]
</p>
</form>