fix(install): add password validation when creating super admin
This commit is contained in:
parent
73f094daf2
commit
5a2ca0cc4a
|
@ -292,7 +292,18 @@ class InstallController extends Controller
|
||||||
*/
|
*/
|
||||||
public function attemptCreateSuperAdmin(): RedirectResponse
|
public function attemptCreateSuperAdmin(): RedirectResponse
|
||||||
{
|
{
|
||||||
|
// validate user password
|
||||||
|
$rules = [
|
||||||
|
'password' => 'required|strong_password',
|
||||||
|
];
|
||||||
|
|
||||||
$userModel = new UserModel();
|
$userModel = new UserModel();
|
||||||
|
if (! $this->validate($rules)) {
|
||||||
|
return redirect()
|
||||||
|
->back()
|
||||||
|
->withInput()
|
||||||
|
->with('errors', $userModel->errors());
|
||||||
|
}
|
||||||
|
|
||||||
// Save the user
|
// Save the user
|
||||||
$user = new User([
|
$user = new User([
|
||||||
|
@ -301,6 +312,7 @@ class InstallController extends Controller
|
||||||
'password' => $this->request->getPost('password'),
|
'password' => $this->request->getPost('password'),
|
||||||
'is_owner' => true,
|
'is_owner' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$userModel->save($user);
|
$userModel->save($user);
|
||||||
} catch (ValidationException) {
|
} catch (ValidationException) {
|
||||||
|
|
Loading…
Reference in New Issue