1 | <?php |
||
15 | class PasswordResetBroker implements PasswordResetBrokerContract |
||
16 | { |
||
17 | /** |
||
18 | * The application key. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $key; |
||
23 | |||
24 | /** |
||
25 | * The user provider implementation. |
||
26 | * |
||
27 | * @var \Illuminate\Contracts\Auth\UserProvider |
||
28 | */ |
||
29 | protected $users; |
||
30 | |||
31 | /** |
||
32 | * The number of minutes that the reset token should be considered valid. |
||
33 | * |
||
34 | * @var int |
||
35 | */ |
||
36 | protected $expiration; |
||
37 | |||
38 | /** |
||
39 | * The custom password validator callback. |
||
40 | * |
||
41 | * @var \Closure |
||
42 | */ |
||
43 | protected $passwordValidator; |
||
44 | |||
45 | /** |
||
46 | * Create a new verification broker instance. |
||
47 | * |
||
48 | * @param \Illuminate\Contracts\Auth\UserProvider $users |
||
49 | * @param string $key |
||
50 | * @param int $expiration |
||
51 | */ |
||
52 | public function __construct(UserProvider $users, $key, $expiration) |
||
58 | |||
59 | /** |
||
60 | * Send a password reset link to a user. |
||
61 | * |
||
62 | * @param array $credentials |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | public function sendResetLink(array $credentials): string |
||
86 | |||
87 | /** |
||
88 | * Reset the password for the given token. |
||
89 | * |
||
90 | * @param array $credentials |
||
91 | * @param \Closure $callback |
||
92 | * |
||
93 | * @return mixed |
||
|
|||
94 | */ |
||
95 | public function reset(array $credentials, Closure $callback) |
||
115 | |||
116 | /** |
||
117 | * Set a custom password validator. |
||
118 | * |
||
119 | * @param \Closure $callback |
||
120 | * |
||
121 | * @return void |
||
122 | */ |
||
123 | public function validator(Closure $callback): void |
||
127 | |||
128 | /** |
||
129 | * Determine if the passwords match for the request. |
||
130 | * |
||
131 | * @param array $credentials |
||
132 | * |
||
133 | * @return bool |
||
134 | */ |
||
135 | public function validateNewPassword(array $credentials): bool |
||
150 | |||
151 | /** |
||
152 | * Determine if the passwords are valid for the request. |
||
153 | * |
||
154 | * @param array $credentials |
||
155 | * |
||
156 | * @return bool |
||
157 | */ |
||
158 | protected function validatePasswordWithDefaults(array $credentials): bool |
||
167 | |||
168 | /** |
||
169 | * Get the user for the given credentials. |
||
170 | * |
||
171 | * @param array $credentials |
||
172 | * |
||
173 | * @throws \UnexpectedValueException |
||
174 | * |
||
175 | * @return \Rinvex\Auth\Contracts\CanResetPasswordContract |
||
176 | */ |
||
177 | public function getUser(array $credentials): CanResetPasswordContract |
||
187 | |||
188 | /** |
||
189 | * Create a new password reset token for the given user. |
||
190 | * |
||
191 | * @param \Rinvex\Auth\Contracts\CanResetPasswordContract $user |
||
192 | * @param int $expiration |
||
193 | * |
||
194 | * @return string |
||
195 | */ |
||
196 | public function createToken(CanResetPasswordContract $user, $expiration): string |
||
202 | |||
203 | /** |
||
204 | * Validate the given password reset token. |
||
205 | * |
||
206 | * @param \Rinvex\Auth\Contracts\CanResetPasswordContract $user |
||
207 | * @param array $credentials |
||
208 | * |
||
209 | * @return bool |
||
210 | */ |
||
211 | public function validateToken(CanResetPasswordContract $user, array $credentials): bool |
||
217 | |||
218 | /** |
||
219 | * Validate the given expiration timestamp. |
||
220 | * |
||
221 | * @param int $expiration |
||
222 | * |
||
223 | * @return bool |
||
224 | */ |
||
225 | public function validateTimestamp($expiration): bool |
||
229 | |||
230 | /** |
||
231 | * Return the application key. |
||
232 | * |
||
233 | * @return string |
||
234 | */ |
||
235 | public function getKey(): string |
||
243 | |||
244 | /** |
||
245 | * Returns the payload string containing. |
||
246 | * |
||
247 | * @param \Rinvex\Auth\Contracts\CanResetPasswordContract $user |
||
248 | * @param string $email |
||
249 | * @param int $expiration |
||
250 | * |
||
251 | * @return string |
||
252 | */ |
||
253 | protected function buildPayload(CanResetPasswordContract $user, $email, $expiration): string |
||
262 | |||
263 | /** |
||
264 | * Validate a password reset for the given credentials. |
||
265 | * |
||
266 | * @param array $credentials |
||
267 | * |
||
268 | * @return \Illuminate\Contracts\Auth\CanResetPassword|string |
||
269 | */ |
||
270 | protected function validateReset(array $credentials) |
||
290 | } |
||
291 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.