ConfirmablePasswordController::show()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
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
     * @param  \Illuminate\Http\Request  $request
17
     * @return \Illuminate\View\View
18
     */
19
    public function show(Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

19
    public function show(/** @scrutinizer ignore-unused */ Request $request)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
20
    {
21
        return view('auth.confirm-password');
22
    }
23
24
    /**
25
     * Confirm the user's password.
26
     *
27
     * @param  \Illuminate\Http\Request  $request
28
     * @return mixed
29
     */
30
    public function store(Request $request)
31
    {
32
        if (! Auth::guard('web')->validate([
33
            'email' => $request->user()->email,
34
            'password' => $request->password,
35
        ])) {
36
            throw ValidationException::withMessages([
37
                'password' => __('messages.password'),
38
            ]);
39
        }
40
41
        $request->session()->put('auth.password_confirmed_at', time());
42
43
        return redirect()->intended(RouteServiceProvider::HOME);
44
    }
45
}
46