diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 10 | ||||
-rw-r--r-- | templates/web/default/admin/user-form.html | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 424f68ba3..6264d1a73 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -961,6 +961,11 @@ sub user_add : Path('user_edit') : Args(0) { $c->forward('check_token'); + if ( $c->cobrand->moniker eq 'zurich' and $c->req->param('email') eq '' ) { + $c->stash->{field_errors}->{email} = _('The email field is required'); + return 1; + } + return unless $c->req->param('name') && $c->req->param('email'); my $user = $c->model('DB::User')->find_or_create( { @@ -1008,6 +1013,11 @@ sub user_edit : Path('user_edit') : Args(1) { $user->email( $c->req->param('email') ); $user->from_body( $c->req->param('body') || undef ); $user->flagged( $c->req->param('flagged') || 0 ); + + if ( $c->cobrand->moniker eq 'zurich' and $user->email eq '' ) { + $c->stash->{field_errors}->{email} = _('The email field is required'); + return 1; + } $user->update; if ($edited) { diff --git a/templates/web/default/admin/user-form.html b/templates/web/default/admin/user-form.html index 489752d8c..4a57b05a0 100644 --- a/templates/web/default/admin/user-form.html +++ b/templates/web/default/admin/user-form.html @@ -1,6 +1,10 @@ <form method="post" action="[% c.uri_for( 'user_edit', user.id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> <input type="hidden" name="token" value="[% token %]" > <input type="hidden" name="submit" value="1" > + + [% IF c.cobrand.moniker == 'zurich' AND field_errors.email %] + <p class='error'>[% field_errors.email %]</p> + [% END %] <ul class="no-bullets"> <li> <div class="admin-hint"> |