aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Admin.pm
diff options
context:
space:
mode:
authorChris Mytton <self@hecticjeff.net>2013-10-15 14:04:16 +0100
committerChris Mytton <self@hecticjeff.net>2013-10-15 14:04:16 +0100
commit342dac24c58c0493dd32726bd4c05a9ba61fba0b (patch)
tree8397be9ad583be4f60c37d903fe34c653d95116e /perllib/FixMyStreet/App/Controller/Admin.pm
parent82efeac919e758a3b8bd833e5dba452d470c70da (diff)
[Zurich] Add user email address validation to the admin
Closes mysociety/FixMyStreet-Commercial#426
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm10
1 files changed, 10 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) {