ConfirmablePasswordController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A show() 0 3 1
A store() 0 14 2
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 Inertia\Inertia;
11
use Inertia\Response;
12
13
class ConfirmablePasswordController extends Controller
14
{
15
    /**
16
     * Show the confirm password view.
17
     */
18
    public function show(): Response
19
    {
20
        return Inertia::render('Auth/ConfirmPassword');
21
    }
22
23
    /**
24
     * Confirm the user's password.
25
     */
26
    public function store(Request $request): RedirectResponse
27
    {
28
        if (! Auth::guard('web')->validate([
29
            'email' => $request->user()->email,
0 ignored issues
show
Bug introduced by
The method user() does not exist on Illuminate\Http\Request. ( Ignorable by Annotation )

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

29
            'email' => $request->/** @scrutinizer ignore-call */ user()->email,

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
            'password' => $request->password,
0 ignored issues
show
Bug introduced by
The property password does not seem to exist on Illuminate\Http\Request.
Loading history...
31
        ])) {
32
            throw ValidationException::withMessages([
33
                'password' => __('auth.password'),
34
            ]);
35
        }
36
37
        $request->session()->put('auth.password_confirmed_at', time());
0 ignored issues
show
Bug introduced by
The method session() does not exist on Illuminate\Http\Request. ( Ignorable by Annotation )

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

37
        $request->/** @scrutinizer ignore-call */ 
38
                  session()->put('auth.password_confirmed_at', time());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
38
39
        return redirect()->intended(route('dashboard', absolute: false));
40
    }
41
}
42