|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Afrittella\BackProject\Http\Controllers\Auth; |
|
4
|
|
|
|
|
5
|
|
|
use Afrittella\BackProject\Http\Controllers\Controller; |
|
6
|
|
|
use Illuminate\Foundation\Auth\ResetsPasswords; |
|
7
|
|
|
use Illuminate\Http\Request; |
|
8
|
|
|
|
|
9
|
|
|
class ResetPasswordController extends Controller |
|
10
|
|
|
{ |
|
11
|
|
|
protected $data = []; // the information we send to the view |
|
12
|
|
|
|
|
13
|
|
|
/* |
|
14
|
|
|
|-------------------------------------------------------------------------- |
|
15
|
|
|
| Password Reset Controller |
|
16
|
|
|
|-------------------------------------------------------------------------- |
|
17
|
|
|
| |
|
18
|
|
|
| This controller is responsible for handling password reset requests |
|
19
|
|
|
| and uses a simple trait to include this behavior. You're free to |
|
20
|
|
|
| explore this trait and override any methods you wish to tweak. |
|
21
|
|
|
| |
|
22
|
|
|
*/ |
|
23
|
|
|
|
|
24
|
|
|
use ResetsPasswords; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Create a new controller instance. |
|
28
|
|
|
* |
|
29
|
|
|
*/ |
|
30
|
|
|
public function __construct() |
|
31
|
|
|
{ |
|
32
|
|
|
$this->middleware('guest'); |
|
33
|
|
|
|
|
34
|
|
|
// where to redirect after password was reset |
|
35
|
|
|
$this->redirectTo = property_exists($this, 'redirectTo') ? $this->redirectTo : config('back-project.route_prefix', 'admin').'/dashboard'; |
|
|
|
|
|
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Display the password reset view for the given token. |
|
40
|
|
|
* |
|
41
|
|
|
* If no token is present, display the link request form. |
|
42
|
|
|
* |
|
43
|
|
|
* @param \Illuminate\Http\Request $request |
|
44
|
|
|
* @param string|null $token |
|
45
|
|
|
* |
|
46
|
|
|
* @return \Illuminate\Http\Response |
|
47
|
|
|
*/ |
|
48
|
|
|
public function showResetForm(Request $request, $token = null) |
|
49
|
|
|
{ |
|
50
|
|
|
$this->data['title'] = trans('back-project::base.reset_password'); // set the page title |
|
51
|
|
|
|
|
52
|
|
|
return view('back-project::auth.passwords.reset', $this->data)->with( |
|
|
|
|
|
|
53
|
|
|
['token' => $token, 'email' => $request->email] |
|
54
|
|
|
); |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: