ResetPasswordController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 58
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A showResetForm() 0 4 1
A sendResetResponse() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Xetaravel\Http\Controllers\Auth;
6
7
use Illuminate\Foundation\Auth\ResetsPasswords;
8
use Illuminate\Http\Request;
9
use Illuminate\Http\RedirectResponse;
10
use Illuminate\View\View;
11
use Xetaravel\Http\Controllers\Controller;
12
13
class ResetPasswordController extends Controller
14
{
15
    /*
16
    |--------------------------------------------------------------------------
17
    | Password Reset Controller
18
    |--------------------------------------------------------------------------
19
    |
20
    | This controller is responsible for handling password reset requests
21
    | and uses a simple trait to include this behavior. You're free to
22
    | explore this trait and override any methods you wish to tweak.
23
    |
24
    */
25
    use ResetsPasswords;
0 ignored issues
show
Bug introduced by
The trait Illuminate\Foundation\Auth\ResetsPasswords requires the property $email which is not provided by Xetaravel\Http\Controlle...ResetPasswordController.
Loading history...
26
27
    /**
28
     * Where to redirect users after resetting their password.
29
     *
30
     * @var string
31
     */
32
    protected string $redirectTo = '/';
33
34
    /**
35
     * Create a new controller instance.
36
     */
37
    public function __construct()
38
    {
39
        parent::__construct();
40
41
        $this->middleware('guest');
42
    }
43
44
    /**
45
     * Get the response for a successful password reset.
46
     *
47
     * @param string $response
48
     *
49
     * @return RedirectResponse
50
     */
51
    protected function sendResetResponse(string $response): RedirectResponse
0 ignored issues
show
Unused Code introduced by
The parameter $response 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

51
    protected function sendResetResponse(/** @scrutinizer ignore-unused */ string $response): RedirectResponse

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...
52
    {
53
        return redirect($this->redirectPath())
54
            ->success('Your password has been reset!');
55
    }
56
57
    /**
58
     * Display the password reset view for the given token.
59
     *
60
     * If no token is present, display the link request form.
61
     *
62
     * @param Request $request
63
     * @param string|null $token
64
     *
65
     * @return View
66
     */
67
    public function showResetForm(Request $request, string $token = null): View
68
    {
69
        return view('Auth.passwords.reset')->with(
70
            ['token' => $token, 'email' => $request->email]
71
        );
72
    }
73
}
74