1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Backpack\Base\app\Http\Controllers\Auth; |
4
|
|
|
|
5
|
|
|
use Auth; |
6
|
|
|
use Backpack\Base\app\Http\Controllers\Controller; |
7
|
|
|
use Illuminate\Foundation\Auth\ResetsPasswords; |
8
|
|
|
use Illuminate\Http\Request; |
9
|
|
|
use Illuminate\Support\Facades\Password; |
10
|
|
|
|
11
|
|
|
class ResetPasswordController extends Controller |
12
|
|
|
{ |
13
|
|
|
protected $data = []; // the information we send to the view |
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
|
|
|
|
26
|
|
|
use ResetsPasswords; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Create a new controller instance. |
30
|
|
|
* |
31
|
|
|
* @return void |
|
|
|
|
32
|
|
|
*/ |
33
|
|
View Code Duplication |
public function __construct() |
|
|
|
|
34
|
|
|
{ |
35
|
|
|
$guard = config('backpack.base.guard') |
36
|
|
|
?: config('auth.defaults.guard'); |
37
|
|
|
|
38
|
|
|
$this->middleware("guest:$guard"); |
39
|
|
|
|
40
|
|
|
// where to redirect after password was reset |
41
|
|
|
$this->redirectTo = property_exists($this, 'redirectTo') ? $this->redirectTo : config('backpack.base.route_prefix', 'admin').'/dashboard'; |
|
|
|
|
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
// ------------------------------------------------------- |
45
|
|
|
// Laravel overwrites for loading backpack views |
46
|
|
|
// ------------------------------------------------------- |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Display the password reset view for the given token. |
50
|
|
|
* |
51
|
|
|
* If no token is present, display the link request form. |
52
|
|
|
* |
53
|
|
|
* @param \Illuminate\Http\Request $request |
54
|
|
|
* @param string|null $token |
55
|
|
|
* |
56
|
|
|
* @return \Illuminate\Http\Response |
57
|
|
|
*/ |
58
|
|
|
public function showResetForm(Request $request, $token = null) |
59
|
|
|
{ |
60
|
|
|
$this->data['title'] = trans('backpack::base.reset_password'); // set the page title |
61
|
|
|
|
62
|
|
|
return view('backpack::auth.passwords.reset', $this->data)->with( |
|
|
|
|
63
|
|
|
['token' => $token, 'email' => $request->email] |
64
|
|
|
); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function broker() |
68
|
|
|
{ |
69
|
|
|
$passwords = config('backpack.base.passwords') |
70
|
|
|
?: config('auth.defaults.passwords'); |
71
|
|
|
|
72
|
|
|
return Password::broker($passwords); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
protected function guard() |
76
|
|
|
{ |
77
|
|
|
$guard = config('backpack.base.guard') |
78
|
|
|
?: config('auth.defaults.guard'); |
79
|
|
|
|
80
|
|
|
return Auth::guard($guard); |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.