Mercurial > borealpoint
diff app/Http/Controllers/Auth/ConfirmablePasswordController.php @ 0:9d7dcd54c677
Initial Commit and package setup
| author | luka |
|---|---|
| date | Sat, 23 Aug 2025 22:20:51 -0400 |
| parents | |
| children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/Http/Controllers/Auth/ConfirmablePasswordController.php Sat Aug 23 22:20:51 2025 -0400 @@ -0,0 +1,40 @@ +<?php + +namespace App\Http\Controllers\Auth; + +use App\Http\Controllers\Controller; +use Illuminate\Http\RedirectResponse; +use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; +use Illuminate\Validation\ValidationException; +use Illuminate\View\View; + +class ConfirmablePasswordController extends Controller +{ + /** + * Show the confirm password view. + */ + public function show(): View + { + return view('auth.confirm-password'); + } + + /** + * Confirm the user's password. + */ + public function store(Request $request): RedirectResponse + { + if (! Auth::guard('web')->validate([ + 'email' => $request->user()->email, + 'password' => $request->password, + ])) { + throw ValidationException::withMessages([ + 'password' => __('auth.password'), + ]); + } + + $request->session()->put('auth.password_confirmed_at', time()); + + return redirect()->intended(route('dashboard', absolute: false)); + } +}
