1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\Controllers\Auth; |
4
|
|
|
|
5
|
|
|
use App\Http\Controllers\Auth\AuthController; |
6
|
|
|
use Illuminate\Foundation\Auth\ResetsPasswords; |
7
|
|
|
use Illuminate\Http\Request; |
8
|
|
|
use Facades\App\Services\WhichPortal; |
9
|
|
|
use App\Services\Validation\Rules\PasswordFormatRule; |
10
|
|
|
use Illuminate\Support\Facades\Lang; |
11
|
|
|
|
12
|
|
|
class ResetPasswordController extends AuthController |
13
|
|
|
{ |
14
|
|
|
/* |
15
|
|
|
|-------------------------------------------------------------------------- |
16
|
|
|
| Password Reset Controller |
17
|
|
|
|-------------------------------------------------------------------------- |
18
|
|
|
| |
19
|
|
|
| This controller is responsible for handling password reset requests |
20
|
|
|
| and uses a simple trait to include this behavior. You're free to |
21
|
|
|
| explore this trait and override any methods you wish to tweak. |
22
|
|
|
| |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
use ResetsPasswords; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Where to redirect users after resetting their password. |
29
|
|
|
* |
30
|
|
|
* @return string |
31
|
|
|
*/ |
32
|
|
|
protected function redirectTo() |
33
|
|
|
{ |
34
|
|
|
if (WhichPortal::isManagerPortal()) { |
35
|
|
|
$redirectTo = route('manager.home'); |
|
|
|
|
36
|
|
|
} elseif (WhichPortal::isHrPortal()) { |
37
|
|
|
$redirectTo = route('hr_advisor.home'); |
38
|
|
|
} else { |
39
|
|
|
$redirectTo = route('home'); |
40
|
|
|
} |
41
|
|
|
return $redirectTo; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Create a new controller instance. |
46
|
|
|
* |
47
|
|
|
* @return void |
48
|
|
|
*/ |
49
|
|
|
public function __construct() |
50
|
|
|
{ |
51
|
|
|
$this->middleware('guest'); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Display the password reset view for the given token. |
56
|
|
|
* |
57
|
|
|
* If no token is present, display the link request form. |
58
|
|
|
* |
59
|
|
|
* @param \Illuminate\Http\Request $request Incoming Request. |
60
|
|
|
* @param string|null $token Validation token. |
61
|
|
|
* @return \Illuminate\Http\Response |
62
|
|
|
*/ |
63
|
|
|
public function showResetForm(Request $request, $token = null) |
64
|
|
|
{ |
65
|
|
|
return view('auth.passwords.reset')->with([ |
|
|
|
|
66
|
|
|
'token' => $token, |
67
|
|
|
'email' => $request->email, |
68
|
|
|
'routes' => $this->auth_routes(), |
69
|
|
|
'reset_password' => Lang::get('common/auth/reset_password'), |
70
|
|
|
]); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* OVERRIDE |
75
|
|
|
* Get the password reset validation rules. |
76
|
|
|
* |
77
|
|
|
* @return array |
78
|
|
|
*/ |
79
|
|
|
protected function rules() |
80
|
|
|
{ |
81
|
|
|
return [ |
82
|
|
|
'token' => 'required', |
83
|
|
|
'email' => 'required|email', |
84
|
|
|
'password' => [ |
85
|
|
|
'required', |
86
|
|
|
'min:8', |
87
|
|
|
new PasswordFormatRule, |
88
|
|
|
'confirmed' |
89
|
|
|
], |
90
|
|
|
]; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* OVERRIDE |
95
|
|
|
* Get the password reset validation error messages. |
96
|
|
|
* |
97
|
|
|
* @return array |
98
|
|
|
*/ |
99
|
|
|
protected function validationErrorMessages() |
100
|
|
|
{ |
101
|
|
|
return []; |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
|