ConfirmablePasswordController::show()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace App\Http\Controllers\Auth;
4
5
use App\Http\Controllers\Controller;
6
use App\Providers\RouteServiceProvider;
7
use Illuminate\Http\RedirectResponse;
8
use Illuminate\Http\Request;
9
use Illuminate\Support\Facades\Auth;
10
use Illuminate\Validation\ValidationException;
11
use Illuminate\View\View;
12
13
class ConfirmablePasswordController extends Controller
14
{
15
    /**
16
     * Show the confirm password view.
17
     */
18 1
    public function show(): View
19
    {
20 1
        return view('auth.confirm-password');
21
    }
22
23
    /**
24
     * Confirm the user's password.
25
     */
26 2
    public function store(Request $request): RedirectResponse
27
    {
28 2
        if (! Auth::guard('web')->validate([
29 2
            'email' => $request->user()->email,
30 2
            'password' => $request->password,
31 2
        ])) {
32 1
            throw ValidationException::withMessages([
33 1
                'password' => __('auth.password'),
34 1
            ]);
35
        }
36
37 1
        $request->session()->put('auth.password_confirmed_at', time());
38
39 1
        return redirect()->intended(RouteServiceProvider::HOME);
40
    }
41
}
42