ConfirmablePasswordController::show()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

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
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\Request;
8
use Illuminate\Support\Facades\Auth;
9
use Illuminate\Validation\ValidationException;
10
11
class ConfirmablePasswordController extends Controller
12
{
13
    /**
14
     * Show the confirm password view.
15
     *
16
     * @return \Illuminate\View\View
17
     */
18
    public function show()
19
    {
20
        return view('auth.confirm-password');
21
    }
22
23
    /**
24
     * Confirm the user's password.
25
     *
26
     * @param  \Illuminate\Http\Request  $request
27
     * @return mixed
28
     */
29
    public function store(Request $request)
30
    {
31
        if (! Auth::guard('web')->validate([
32
            'email' => $request->user()->email,
33
            'password' => $request->password,
34
        ])) {
35
            throw ValidationException::withMessages([
36
                'password' => __('auth.password'),
37
            ]);
38
        }
39
40
        $request->session()->put('auth.password_confirmed_at', time());
41
42
        return redirect()->intended(RouteServiceProvider::HOME);
43
    }
44
}
45