Skip to content
Snippets Groups Projects
Commit 5a2ca0cc authored by Yassine Doghri's avatar Yassine Doghri
Browse files

fix(install): add password validation when creating super admin

parent 73f094da
No related branches found
No related tags found
No related merge requests found
......@@ -292,7 +292,18 @@ class InstallController extends Controller
*/
public function attemptCreateSuperAdmin(): RedirectResponse
{
// validate user password
$rules = [
'password' => 'required|strong_password',
];
$userModel = new UserModel();
if (! $this->validate($rules)) {
return redirect()
->back()
->withInput()
->with('errors', $userModel->errors());
}
// Save the user
$user = new User([
......@@ -301,6 +312,7 @@ class InstallController extends Controller
'password' => $this->request->getPost('password'),
'is_owner' => true,
]);
try {
$userModel->save($user);
} catch (ValidationException) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment