diff options
author | Zarino Zappia <mail@zarino.co.uk> | 2018-11-23 13:37:54 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-12-05 13:05:11 +0000 |
commit | 1c288ef2dfc1b2e57d6a51c11401e95e8c589bd4 (patch) | |
tree | 7c3fb8cbfafb1ebabd6f6095dd4d055cef8315b4 /perllib | |
parent | c21b8a0455ae1416887e89358b945322edd761ed (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 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 6 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/Update.pm | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 1a1a657a9..ce2fe19f6 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -6,6 +6,7 @@ BEGIN { extends 'Catalyst::Controller'; } use Encode; use List::MoreUtils qw(uniq); +use List::Util 'first'; use POSIX 'strcoll'; use HTML::Entities; use mySociety::MaPit; @@ -789,7 +790,10 @@ sub process_user : Private { # Extract all the params to a hash to make them easier to work with my %params = map { $_ => $c->get_param($_) } - ( 'username', 'email', 'name', 'phone', 'password_register', 'fms_extra_title' ); + ( 'email', 'name', 'phone', 'password_register', 'fms_extra_title' ); + + # Report form includes two username fields: #form_username_register and #form_username_sign_in + $params{username} = (first { $_ } $c->get_param_list('username')) || ''; if ( $c->cobrand->allow_anonymous_reports ) { my $anon_details = $c->cobrand->anonymous_account; diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm index dc46be61f..cbedf7a01 100644 --- a/perllib/FixMyStreet/App/Controller/Report/Update.pm +++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm @@ -5,6 +5,7 @@ use namespace::autoclean; BEGIN { extends 'Catalyst::Controller'; } use Path::Class; +use List::Util 'first'; use Utils; =head1 NAME @@ -99,7 +100,10 @@ sub process_user : Private { # Extract all the params to a hash to make them easier to work with my %params = map { $_ => $c->get_param($_) } - ( 'username', 'name', 'password_register', 'fms_extra_title' ); + ( 'name', 'password_register', 'fms_extra_title' ); + + # Update form includes two username fields: #form_username_register and #form_username_sign_in + $params{username} = (first { $_ } $c->get_param_list('username')) || ''; # Extra block to use 'last' if ( $c->user_exists ) { { |