diff --git a/app/Models/User.php b/app/Models/User.php index ec906ba88..8390a01f8 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -31,7 +31,6 @@ use Illuminate\Database\Eloquent\Relations\MorphToMany; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; -use App\Notifications\SendPasswordReset as ResetPasswordNotification; use ResourceBundle; use Spatie\Permission\Traits\HasRoles; @@ -201,21 +200,6 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac return $rules; } - /** - * Send the password reset notification. - * - * @param string $token - */ - public function sendPasswordResetNotification($token): void - { - Activity::event('auth:reset-password') - ->withRequestMetadata() - ->subject($this) - ->log('sending password reset email'); - - $this->notify(new ResetPasswordNotification($token)); - } - public function username(): Attribute { return Attribute::make( diff --git a/app/Notifications/AccountCreated.php b/app/Notifications/AccountCreated.php index 241f0ae5d..4f3ba975d 100644 --- a/app/Notifications/AccountCreated.php +++ b/app/Notifications/AccountCreated.php @@ -3,6 +3,7 @@ namespace App\Notifications; use App\Models\User; +use Filament\Facades\Filament; use Illuminate\Bus\Queueable; use Illuminate\Notifications\Notification; use Illuminate\Contracts\Queue\ShouldQueue; @@ -29,7 +30,7 @@ class AccountCreated extends Notification implements ShouldQueue ->line('Email: ' . $notifiable->email); if (!is_null($this->token)) { - return $message->action('Setup Your Account', url('/auth/password/reset/' . $this->token . '?email=' . urlencode($notifiable->email))); + return $message->action('Setup Your Account', Filament::getResetPasswordUrl($this->token, $notifiable)); } return $message; diff --git a/app/Notifications/SendPasswordReset.php b/app/Notifications/SendPasswordReset.php deleted file mode 100644 index 91132b06a..000000000 --- a/app/Notifications/SendPasswordReset.php +++ /dev/null @@ -1,31 +0,0 @@ -subject('Reset Password') - ->line('You are receiving this email because we received a password reset request for your account.') - ->action('Reset Password', url('/auth/password/reset/' . $this->token . '?email=' . urlencode($notifiable->email))) - ->line('If you did not request a password reset, no further action is required.'); - } -} diff --git a/app/Providers/Filament/AdminPanelProvider.php b/app/Providers/Filament/AdminPanelProvider.php index a63c9991c..03cc5c44c 100644 --- a/app/Providers/Filament/AdminPanelProvider.php +++ b/app/Providers/Filament/AdminPanelProvider.php @@ -39,6 +39,7 @@ class AdminPanelProvider extends PanelProvider ->topNavigation(config('panel.filament.top-navigation', true)) ->maxContentWidth(config('panel.filament.display-width', 'screen-2xl')) ->login(Login::class) + ->passwordReset() ->userMenuItems([ 'profile' => MenuItem::make() ->label(fn () => trans('filament-panels::pages/auth/edit-profile.label')) diff --git a/app/Providers/Filament/AppPanelProvider.php b/app/Providers/Filament/AppPanelProvider.php index 8d5111878..a56fd72bb 100644 --- a/app/Providers/Filament/AppPanelProvider.php +++ b/app/Providers/Filament/AppPanelProvider.php @@ -37,6 +37,7 @@ class AppPanelProvider extends PanelProvider ->navigation(false) ->profile(EditProfile::class, false) ->login(Login::class) + ->passwordReset() ->userMenuItems([ MenuItem::make() ->label('Admin') diff --git a/app/Providers/Filament/ServerPanelProvider.php b/app/Providers/Filament/ServerPanelProvider.php index c48e0bc79..28e1f0a03 100644 --- a/app/Providers/Filament/ServerPanelProvider.php +++ b/app/Providers/Filament/ServerPanelProvider.php @@ -42,6 +42,7 @@ class ServerPanelProvider extends PanelProvider ->topNavigation(config('panel.filament.top-navigation', true)) ->maxContentWidth(config('panel.filament.display-width', 'screen-2xl')) ->login(Login::class) + ->passwordReset() ->userMenuItems([ 'profile' => MenuItem::make() ->label(fn () => trans('filament-panels::pages/auth/edit-profile.label')) diff --git a/lang/en/activity.php b/lang/en/activity.php index d734daca5..9518ac970 100644 --- a/lang/en/activity.php +++ b/lang/en/activity.php @@ -11,7 +11,6 @@ return [ 'fail' => 'Failed log in', 'success' => 'Logged in', 'password-reset' => 'Password reset', - 'reset-password' => 'Requested password reset', 'checkpoint' => 'Two-factor authentication requested', 'recovery-token' => 'Used two-factor recovery token', 'token' => 'Solved two-factor challenge',