Skip to content

Commit

Permalink
small improvments
Browse files Browse the repository at this point in the history
  • Loading branch information
gheorghelupu17 committed Sep 23, 2024
1 parent 8c46047 commit c891ef0
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Facades\RateLimiter;

const HOUR_IN_SECONDS = 3600;
class ResetPasswordAction extends Action
{
public static function getDefaultName(): ?string
Expand All @@ -36,17 +37,23 @@ protected function setUp(): void
return;
}

RateLimiter::increment($key, 3600);
RateLimiter::increment($key, HOUR_IN_SECONDS);

$response = Password::broker(config('filament-breezy.reset_broker', config('auth.defaults.passwords')))->sendResetLink(['email' => $record->email]);
if ($response == Password::RESET_LINK_SENT) {
Notification::make()->title(__('filament-breezy::default.reset_password.notification_success'))->success()->send();
} else {
Notification::make()->title(match ($response) {
'passwords.throttled' => __('passwords.throttled'),
'passwords.user' => __('passwords.user')
})->danger()->send();
if ($response === Password::RESET_LINK_SENT) {
Notification::make()
->title(__('filament-breezy::default.reset_password.notification_success'))
->success()
->send();

return;
}
Notification::make()->title(match ($response) {
'passwords.throttled' => __('passwords.throttled'),
'passwords.user' => __('passwords.user')
})
->danger()
->send();
});
}

Expand Down

0 comments on commit c891ef0

Please sign in to comment.