Allow changing email, username and password

This commit is contained in:
2026-01-08 16:14:35 +01:00
parent 2029af334c
commit 8f99718058
4 changed files with 52 additions and 9 deletions

View File

@@ -15,6 +15,20 @@ class PasswordController extends Controller
*/
public function update(Request $request): RedirectResponse
{
// If user logged in with Discord and has not yet a password, allow to set password
if ($request->user()->discord_id && is_null($request->user()->password))
{
$validated = $request->validateWithBag('updatePassword', [
'password' => ['required', Password::defaults(), 'confirmed'],
]);
$request->user()->update([
'password' => Hash::make($validated['password']),
]);
return back()->with('status', 'password-updated');
}
$validated = $request->validateWithBag('updatePassword', [
'current_password' => ['required', 'current_password'],
'password' => ['required', Password::defaults(), 'confirmed'],