From acf4d600b535e08fad462c70cbebc627ba0754c8 Mon Sep 17 00:00:00 2001 From: amosfolz <33728190+amosfolz@users.noreply.github.com> Date: Fri, 19 Jul 2019 13:28:06 -0400 Subject: [PATCH] allow admin to set user password on creation --- app/sprinkles/admin/schema/requests/user/create.yaml | 2 +- app/sprinkles/admin/src/Controller/UserController.php | 4 ++-- .../templates/forms/partials/user-set-password.html.twig | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/sprinkles/admin/schema/requests/user/create.yaml b/app/sprinkles/admin/schema/requests/user/create.yaml index 9094a765f..821482001 100644 --- a/app/sprinkles/admin/schema/requests/user/create.yaml +++ b/app/sprinkles/admin/schema/requests/user/create.yaml @@ -70,7 +70,7 @@ group_id: label: "&GROUP" domain: server message: VALIDATE.INTEGER -value: +password: validators: required: domain: client diff --git a/app/sprinkles/admin/src/Controller/UserController.php b/app/sprinkles/admin/src/Controller/UserController.php index c46bd0934..4c6cfa4a9 100644 --- a/app/sprinkles/admin/src/Controller/UserController.php +++ b/app/sprinkles/admin/src/Controller/UserController.php @@ -133,11 +133,11 @@ public function create(Request $request, Response $response, $args) } $data['flag_verified'] = 1; - if (!isset($data['value'])) { + if (!isset($data['password'])) { // Set password as empty on initial creation. We will then send email so new user can set it themselves via a verification token $data['password'] = ''; } else { - $data['password'] = Password::hash($data['value']); + $data['password'] = Password::hash($data['password']); } // All checks passed! log events/activities, create user, and send verification email (if required) diff --git a/app/sprinkles/admin/templates/forms/partials/user-set-password.html.twig b/app/sprinkles/admin/templates/forms/partials/user-set-password.html.twig index b618a525f..36a3b653f 100644 --- a/app/sprinkles/admin/templates/forms/partials/user-set-password.html.twig +++ b/app/sprinkles/admin/templates/forms/partials/user-set-password.html.twig @@ -22,7 +22,7 @@