Conditions | 3 |
Paths | 2 |
Total Lines | 24 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | public function __invoke(ResetTokenRequest $request) |
||
20 | { |
||
21 | $status = Password::reset( |
||
22 | $request->only('email', 'password', 'password_confirmation', 'token'), |
||
23 | function($user, $password) |
||
24 | { |
||
25 | // Determine the new expiration date |
||
26 | $expires = config('auth.passwords.settings.expire') ? Carbon::now()->addDays(config('auth.passwords.settings.expire')) : null; |
||
27 | |||
28 | $user->forceFill([ |
||
29 | 'password' => Hash::make($password), |
||
30 | 'password_expires' => $expires, |
||
31 | ]); |
||
32 | |||
33 | $user->save(); |
||
34 | event(new PasswordReset($user)); |
||
35 | } |
||
36 | ); |
||
37 | |||
38 | return $status == Password::PASSWORD_RESET |
||
39 | ? redirect()->route('login.index')->with([ |
||
40 | 'message' => 'Password Successfully Updated', |
||
41 | 'type' => 'success' |
||
42 | ]) : back()->withErrors(['email' => [__($status)]]); |
||
43 | } |
||
45 |