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; |
|
|
|
|
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 |
|
|
|
|
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
|
|
|
|