diff --git a/app/Console/Commands/ResetRootPassword.php b/app/Console/Commands/ResetRootPassword.php new file mode 100644 index 000000000..61e0eb309 --- /dev/null +++ b/app/Console/Commands/ResetRootPassword.php @@ -0,0 +1,49 @@ +info('You are about to reset the root password.'); + $password = password('Give me a new password for root user: '); + $passwordAgain = password('Again'); + if ($password != $passwordAgain) { + $this->error('Passwords do not match.'); + return; + } + $this->info('Updating root password...'); + try { + User::find(0)->update(['password' => Hash::make($password)]); + $this->info('Root password updated successfully.'); + } catch (\Exception $e) { + $this->error('Failed to update root password.'); + return; + } + } +}