-
Notifications
You must be signed in to change notification settings - Fork 470
/
ConfirmsPasswords.php
71 lines (61 loc) · 1.58 KB
/
ConfirmsPasswords.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
namespace Illuminate\Foundation\Auth;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
trait ConfirmsPasswords
{
use RedirectsUsers;
/**
* Display the password confirmation view.
*
* @return \Illuminate\Http\Response
*/
public function showConfirmForm()
{
return view('auth.passwords.confirm');
}
/**
* Confirm the given user's password.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
*/
public function confirm(Request $request)
{
$request->validate($this->rules(), $this->validationErrorMessages());
$this->resetPasswordConfirmationTimeout($request);
return $request->wantsJson()
? new Response('', 204)
: redirect()->intended($this->redirectPath());
}
/**
* Reset the password confirmation timeout.
*
* @param \Illuminate\Http\Request $request
* @return void
*/
protected function resetPasswordConfirmationTimeout(Request $request)
{
$request->session()->put('auth.password_confirmed_at', time());
}
/**
* Get the password confirmation validation rules.
*
* @return array
*/
protected function rules()
{
return [
'password' => 'required|password',
];
}
/**
* Get the password confirmation validation error messages.
*
* @return array
*/
protected function validationErrorMessages()
{
return [];
}
}