1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Backpack\Base\app\Http\Controllers\Auth; |
4
|
|
|
|
5
|
|
|
use Backpack\Base\app\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
|
|
|
* @return void |
|
|
|
|
30
|
|
|
*/ |
31
|
|
|
public function __construct() |
32
|
|
|
{ |
33
|
|
|
$this->middleware(backpack_middleware('guest'), ['except' => 'logout']); |
34
|
|
|
|
35
|
|
|
// where to redirect after password was reset |
36
|
|
|
$this->redirectTo = property_exists($this, 'redirectTo') ? $this->redirectTo : config('backpack.base.route_prefix', 'admin').'/dashboard'; |
|
|
|
|
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function guard() |
40
|
|
|
{ |
41
|
|
|
return \Auth::guard(backpack_guard()); |
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
|
|
|
|
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.