Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Push — revert-3645-logout-other-devic... ( af3268 )
by Cristian
30:12
created

ResetPasswordController::guard()   A

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
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Backpack\CRUD\app\Http\Controllers\Auth;
4
5
use Backpack\CRUD\app\Library\Auth\ResetsPasswords;
6
use Illuminate\Http\Request;
7
use Illuminate\Routing\Controller;
8
use Illuminate\Support\Facades\Password;
9
10
class ResetPasswordController extends Controller
11
{
12
    protected $data = []; // the information we send to the view
13
14
    /*
15
    |--------------------------------------------------------------------------
16
    | Password Reset Controller
17
    |--------------------------------------------------------------------------
18
    |
19
    | This controller is responsible for handling password reset requests
20
    | and uses a simple trait to include this behavior. You're free to
21
    | explore this trait and override any methods you wish to tweak.
22
    |
23
    */
24
25
    use ResetsPasswords;
0 ignored issues
show
Bug introduced by
The trait Backpack\CRUD\app\Library\Auth\ResetsPasswords requires the property $email which is not provided by Backpack\CRUD\app\Http\C...ResetPasswordController.
Loading history...
26
27
    /**
28
     * Get the path the user should be redirected to after password reset.
29
     *
30
     * @param  \Illuminate\Http\Request  $request
31
     * @return string
32
     */
33
    public function redirectTo()
34
    {
35
        return backpack_url();
36
    }
37
38
    /**
39
     * Create a new controller instance.
40
     *
41
     * @return void
42
     */
43
    public function __construct()
44
    {
45
        $guard = backpack_guard_name();
46
47
        $this->middleware("guest:$guard");
48
49
        if (! backpack_users_have_email()) {
50
            abort(501, trans('backpack::base.no_email_column'));
51
        }
52
53
        // where to redirect after password was reset
54
        $this->redirectTo = property_exists($this, 'redirectTo') ? $this->redirectTo : backpack_url('dashboard');
0 ignored issues
show
Bug Best Practice introduced by
The property redirectTo does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
55
    }
56
57
    // -------------------------------------------------------
58
    // Laravel overwrites for loading backpack views
59
    // -------------------------------------------------------
60
61
    /**
62
     * Display the password reset view for the given token.
63
     *
64
     * If no token is present, display the link request form.
65
     *
66
     * @param  \Illuminate\Http\Request  $request
67
     * @param  string|null  $token
68
     * @return \Illuminate\Http\Response
69
     */
70
    public function showResetForm(Request $request, $token = null)
71
    {
72
        $this->data['title'] = trans('backpack::base.reset_password'); // set the page title
73
74
        return view(backpack_view('auth.passwords.reset'), $this->data)->with(
0 ignored issues
show
Bug Best Practice introduced by
The expression return view(backpack_vie...l' => $request->email)) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
75
            ['token' => $token, 'email' => $request->email]
76
        );
77
    }
78
79
    /**
80
     * Get the broker to be used during password reset.
81
     *
82
     * @return \Illuminate\Contracts\Auth\PasswordBroker
83
     */
84
    public function broker()
85
    {
86
        $passwords = config('backpack.base.passwords', config('auth.defaults.passwords'));
87
88
        return Password::broker($passwords);
89
    }
90
91
    /**
92
     * Get the guard to be used during password reset.
93
     *
94
     * @return \Illuminate\Contracts\Auth\StatefulGuard
95
     */
96
    protected function guard()
97
    {
98
        return backpack_auth();
99
    }
100
}
101