aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorZarino Zappia <mail@zarino.co.uk>2018-11-23 13:37:54 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-12-05 13:05:11 +0000
commit1c288ef2dfc1b2e57d6a51c11401e95e8c589bd4 (patch)
tree7c3fb8cbfafb1ebabd6f6095dd4d055cef8315b4 /templates
parentc21b8a0455ae1416887e89358b945322edd761ed (diff)
Move email input nearer password input on forms.
This moves the email input from `user_loggedout.html` closer to the password inputs in `user_loggedout_{by_email,password}.html`, because we want to emphasise the connection between your login email/username and your password, and, now that only one "Yes I have an account / No I do not have an account" fieldset is displayed at a time, there was no reason to ask for the email/username up front. This, however, now means the form includes two username inputs, so: * `Report/New.pm` and `Report/Update.pm` now pick the first non-empty username param and use that. * `user_loggedout_email.html` now expects a `name` parameter, so that we can give the two username inputs unique ids in the markup. Also: * The "optional" phone and email inputs in user_loggedout_by_email.html are printed *after* the main username input if SMS login is enabled (since one or other of them is unhidden by javascript, based on whether you entered a phone number or and email address into the "username" input, and it would look weird to have an input become unhidden *above* the input you’re currently editing).
Diffstat (limited to 'templates')
-rw-r--r--templates/web/base/report/form/user_loggedout.html7
-rw-r--r--templates/web/base/report/form/user_loggedout_by_email.html27
-rw-r--r--templates/web/base/report/form/user_loggedout_email.html4
-rw-r--r--templates/web/base/report/form/user_loggedout_password.html6
-rw-r--r--templates/web/base/report/new/oauth_email_form.html4
-rw-r--r--templates/web/base/report/update/form_user.html3
-rw-r--r--templates/web/bromley/report/form/user_loggedout_email.html4
-rw-r--r--templates/web/zurich/report/new/fill_in_details_form.html4
8 files changed, 34 insertions, 25 deletions
diff --git a/templates/web/base/report/form/user_loggedout.html b/templates/web/base/report/form/user_loggedout.html
index 8743883ee..c9c3fabad 100644
--- a/templates/web/base/report/form/user_loggedout.html
+++ b/templates/web/base/report/form/user_loggedout.html
@@ -2,13 +2,6 @@
<div id="form_sign_in">
[% PROCESS 'report/form/private_details.html' %]
-
-[% IF c.cobrand.social_auth_enabled %]
- [% PROCESS 'report/form/user_loggedout_email.html' required=0 %]
-[% ELSE %]
- [% PROCESS 'report/form/user_loggedout_email.html' required=1 %]
-[% END %]
-
<h2 class="hidden-js">[% tprintf(loc("Do you have a %s password?", "%s is the site name"), site_name) %]</h2>
[% PROCESS 'report/form/user_loggedout_password.html' %]
[% PROCESS 'report/form/user_loggedout_by_email.html' %]
diff --git a/templates/web/base/report/form/user_loggedout_by_email.html b/templates/web/base/report/form/user_loggedout_by_email.html
index e115f6d20..4ae3db868 100644
--- a/templates/web/base/report/form/user_loggedout_by_email.html
+++ b/templates/web/base/report/form/user_loggedout_by_email.html
@@ -8,7 +8,7 @@
[% INCLUDE 'report/_show_name_label.html' %]
[% IF type != 'update' %]
- [% UNLESS c.cobrand.call_hook('disable_phone_number_entry') %]
+ [% IF NOT c.cobrand.call_hook('disable_phone_number_entry') AND NOT c.config.SMS_AUTHENTICATION %]
<div id="js-hide-if-username-phone">
<label for="form_phone">[% loc('Phone number (optional)') %]</label>
[% IF field_errors.phone %]
@@ -17,12 +17,6 @@
<input class="form-control" type="text" value="[% phone | html %]" name="phone" id="form_phone">
</div>
[% END %]
- [% IF c.config.SMS_AUTHENTICATION %]
- <div id="js-hide-if-username-email">
- <label for="form_email">[% loc('Email address (optional)') %]</label>
- <input class="form-control" type="text" value="[% email | html %]" name="email" id="form_email">
- </div>
- [% END %]
[% END %]
[% IF c.cobrand.moniker == 'fixamingata' %]
@@ -31,6 +25,25 @@
</div>
[% END %]
+ [% IF c.cobrand.social_auth_enabled AND NOT email_required %]
+ [% PROCESS 'report/form/user_loggedout_email.html' name='username_register' required=0 %]
+ [% ELSE %]
+ [% PROCESS 'report/form/user_loggedout_email.html' name='username_register' required=1 %]
+ [% END %]
+
+ [% IF type != 'update' AND c.config.SMS_AUTHENTICATION %]
+ [% UNLESS c.cobrand.call_hook('disable_phone_number_entry') %]
+ <div id="js-hide-if-username-phone" class="hidden-js">
+ <label for="form_phone">[% loc('Phone number (optional)') %]</label>
+ <input class="form-control" type="text" value="[% phone | html %]" name="phone" id="form_phone">
+ </div>
+ [% END %]
+ <div id="js-hide-if-username-email" class="hidden-js">
+ <label for="form_email">[% loc('Email address (optional)') %]</label>
+ <input class="form-control" type="text" value="[% email | html %]" name="email" id="form_email">
+ </div>
+ [% END %]
+
[% IF type == 'update' %]
<div class="checkbox-group">
<input type="checkbox" name="add_alert" id="form_add_alert" value="1"[% ' checked' IF add_alert %]>
diff --git a/templates/web/base/report/form/user_loggedout_email.html b/templates/web/base/report/form/user_loggedout_email.html
index 932bc97a7..c32691eb4 100644
--- a/templates/web/base/report/form/user_loggedout_email.html
+++ b/templates/web/base/report/form/user_loggedout_email.html
@@ -9,11 +9,11 @@
[% SET username_value = object.user.email %]
[% END %]
-<label for="form_username">[% username_label %]</label>
+<label for="form_[% name %]">[% username_label %]</label>
[% IF field_errors.username %]
<p class='form-error'>[% field_errors.username %]</p>
[% END %]
-<input type="[% username_type %]" name="username" id="form_username"
+<input type="[% username_type %]" name="username" id="form_[% name %]"
value="[% username_value | html %]"
[% IF required %]required[% END %]
class="form-control required">
diff --git a/templates/web/base/report/form/user_loggedout_password.html b/templates/web/base/report/form/user_loggedout_password.html
index 016da88ad..dfd7d0d14 100644
--- a/templates/web/base/report/form/user_loggedout_password.html
+++ b/templates/web/base/report/form/user_loggedout_password.html
@@ -8,6 +8,12 @@
<a id="js-new-report-hide-sign-in" href="#">[% loc('Fill in your details manually.') %]</a>
</p>
+ [% IF c.cobrand.social_auth_enabled %]
+ [% PROCESS 'report/form/user_loggedout_email.html' name='username_sign_in' required=0 %]
+ [% ELSE %]
+ [% PROCESS 'report/form/user_loggedout_email.html' name='username_sign_in' required=1 %]
+ [% END %]
+
<label for="password_sign_in">[% loc('Your password') %]</label>
[% IF field_errors.password %]
<p class='form-error'>[% field_errors.password %]</p>
diff --git a/templates/web/base/report/new/oauth_email_form.html b/templates/web/base/report/new/oauth_email_form.html
index 394a4b743..5b4622cda 100644
--- a/templates/web/base/report/new/oauth_email_form.html
+++ b/templates/web/base/report/new/oauth_email_form.html
@@ -11,10 +11,8 @@
<fieldset>
<div id="problem_form">
- [% PROCESS 'report/form/user_loggedout_email.html' type='report' object=report required=1 %]
-
<div id="form_sign_in">
- [% PROCESS 'report/form/user_loggedout_by_email.html' object=report type='report' %]
+ [% PROCESS 'report/form/user_loggedout_by_email.html' object=report type='report' email_required=1 %]
</div>
<input type="hidden" name="oauth_need_email" value="1">
diff --git a/templates/web/base/report/update/form_user.html b/templates/web/base/report/update/form_user.html
index 5d4c67528..47ba18c12 100644
--- a/templates/web/base/report/update/form_user.html
+++ b/templates/web/base/report/update/form_user.html
@@ -10,9 +10,8 @@
[% IF c.user_exists %]
[% PROCESS "report/update/form_user_loggedin.html" %]
[% ELSIF oauth_need_email %]
- [% PROCESS 'report/form/user_loggedout_email.html' type='update' object=update required=1 %]
<div id="form_sign_in">
- [% PROCESS 'report/form/user_loggedout_by_email.html' object=update type='update' valid_class='validNameU' %]
+ [% PROCESS 'report/form/user_loggedout_by_email.html' object=update type='update' valid_class='validNameU' email_required=1 %]
<input type="hidden" name="oauth_need_email" value="1">
</div>
[% ELSE %]
diff --git a/templates/web/bromley/report/form/user_loggedout_email.html b/templates/web/bromley/report/form/user_loggedout_email.html
index fc4f83f9c..78b4a0044 100644
--- a/templates/web/bromley/report/form/user_loggedout_email.html
+++ b/templates/web/bromley/report/form/user_loggedout_email.html
@@ -8,7 +8,7 @@
[% SET username_value = object.user.email %]
[% END %]
-<label for="form_username">[% loc('Email' ) %]
+<label for="form_[% name %]">[% loc('Email' ) %]
[% IF type == 'update' %]
<span class="muted">([% loc('We never show your email') %])</span>
[% END %]
@@ -16,7 +16,7 @@
[% IF field_errors.username %]
<p class='form-error'>[% field_errors.username %]</p>
[% END %]
-<input type="[% username_type %]" name="username" id="form_username"
+<input type="[% username_type %]" name="username" id="form_[% name %]"
value="[% username_value | html %]"
[% IF required %]required[% END %]
class="form-control required">
diff --git a/templates/web/zurich/report/new/fill_in_details_form.html b/templates/web/zurich/report/new/fill_in_details_form.html
index bd20efdaa..17e308f07 100644
--- a/templates/web/zurich/report/new/fill_in_details_form.html
+++ b/templates/web/zurich/report/new/fill_in_details_form.html
@@ -50,11 +50,11 @@
[% PROCESS "report/new/category_wrapper.html" %]
- <label for="form_username">[% loc('Your email') %]</label>
+ <label for="form_username_register">[% loc('Your email') %]</label>
[% IF field_errors.username %]
<p class='form-error'>[% field_errors.username %]</p>
[% END %]
- <input class="form-control" type="email" value="[% email | html %]" name="username" id="form_username" required>
+ <input class="form-control" type="email" value="[% email | html %]" name="username" id="form_username_register" required>
<label for="form_name">[% loc('Name') %] [% loc('(optional)') %]</label>
[% IF field_errors.name %]