Passed
Branch master (64a50e)
by Brian
02:57
created

ConfirmPasswordController   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 57
ccs 8
cts 8
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A showConfirmForm() 0 3 1
A __construct() 0 3 1
A resetPasswordConfirmationTimeout() 0 3 1
A rules() 0 4 1
1
<?php
2
3
namespace App\Http\Controllers\Admin\Auth;
4
5
use App\Http\Controllers\Controller;
6
use Illuminate\Foundation\Auth\ConfirmsPasswords;
7
use Illuminate\Http\Request;
8
9
class ConfirmPasswordController extends Controller
10
{
11
    /*
12
    |--------------------------------------------------------------------------
13
    | Confirm Password Controller
14
    |--------------------------------------------------------------------------
15
    |
16
    | This controller is responsible for handling password confirmations and
17
    | uses a simple trait to include the behavior. You're free to explore
18
    | this trait and override any functions that require customization.
19
    |
20
    */
21
22
    use ConfirmsPasswords;
23
24
    /**
25
     * Where to redirect users when the intended url fails.
26
     *
27
     * @var string
28
     */
29
    protected $redirectTo = '/admin';
30
31
    /**
32
     * Create a new controller instance.
33
     */
34 3
    public function __construct()
35
    {
36 3
        $this->middleware('admin.auth');
37
    }
38
39
    /**
40
     * Display the password confirmation view.
41
     *
42
     * @return \Illuminate\Http\Response
43
     */
44 1
    public function showConfirmForm()
45
    {
46 1
        return view('admin.auth.passwords.confirm');
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('admin.auth.passwords.confirm') returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
47
    }
48
49
    /**
50
     * Reset the password confirmation timeout.
51
     */
52 1
    protected function resetPasswordConfirmationTimeout(Request $request)
53
    {
54 1
        $request->session()->put('admin.auth.password_confirmed_at', time());
55
    }
56
57
    /**
58
     * Get the password confirmation validation rules.
59
     *
60
     * @return array
61
     */
62 2
    protected function rules()
63
    {
64
        return [
65 2
            'password' => 'required|password:admin',
66
        ];
67
    }
68
}
69