Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| ConfirmablePasswordController | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| show | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| store | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Controllers\Auth; |
| 4 | |
| 5 | use App\Http\Controllers\Controller; |
| 6 | use Illuminate\Http\RedirectResponse; |
| 7 | use Illuminate\Http\Request; |
| 8 | use Illuminate\Support\Facades\Auth; |
| 9 | use Illuminate\Validation\ValidationException; |
| 10 | use Illuminate\View\View; |
| 11 | |
| 12 | class ConfirmablePasswordController extends Controller |
| 13 | { |
| 14 | /** |
| 15 | * Show the confirm password view. |
| 16 | */ |
| 17 | public function show(): View |
| 18 | { |
| 19 | return view('auth.confirm-password'); |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * Confirm the user's password. |
| 24 | */ |
| 25 | public function store(Request $request): RedirectResponse |
| 26 | { |
| 27 | if (! Auth::guard('web')->validate([ |
| 28 | 'email' => $request->user()->email, |
| 29 | 'password' => $request->password, |
| 30 | ])) { |
| 31 | throw ValidationException::withMessages([ |
| 32 | 'password' => __('auth.password'), |
| 33 | ]); |
| 34 | } |
| 35 | |
| 36 | $request->session()->put('auth.password_confirmed_at', time()); |
| 37 | |
| 38 | return redirect()->intended(route('dashboard', absolute: false)); |
| 39 | } |
| 40 | } |