aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Admin
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2019-05-24 12:20:10 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2019-05-28 17:19:27 +0100
commit413c39aa232c078545fe58a53aebddc152a3340b (patch)
tree4fe0897771d87b9fe437d7680858b28002e19213 /perllib/FixMyStreet/App/Controller/Admin
parentf5b0c0629b9bbab562fe02f722b3ef1bb5bff37a (diff)
Show field entries if error on add user form
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin/Users.pm9
1 files changed, 5 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin/Users.pm b/perllib/FixMyStreet/App/Controller/Admin/Users.pm
index 96539358e..1a51df523 100644
--- a/perllib/FixMyStreet/App/Controller/Admin/Users.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin/Users.pm
@@ -112,9 +112,7 @@ sub add : Local : Args(0) {
$c->stash->{field_errors}->{username} = _('User already exists');
}
- return if %{$c->stash->{field_errors}};
-
- my $user = $c->model('DB::User')->create( {
+ my $user = $c->model('DB::User')->new( {
name => $c->get_param('name'),
email => $email ? $email : undef,
email_verified => $email && $email_v ? 1 : 0,
@@ -126,8 +124,11 @@ sub add : Local : Args(0) {
is_superuser => ( $c->user->is_superuser && $c->get_param('is_superuser') ) || 0,
} );
$c->stash->{user} = $user;
+
+ return if %{$c->stash->{field_errors}};
+
$c->forward('user_cobrand_extra_fields');
- $user->update;
+ $user->insert;
$c->forward( '/admin/log_edit', [ $user->id, 'user', 'edit' ] );