-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a feature to send reset password links in admin panel. (#62)
* Added feature to send reset password links in admin panel. * Removed changes from changelog, as that is automatically updated. * Removed reset password route as it was unnecessary. Renamed PasswordResetController -> PasswordResetService. Simplified sendResetLink. * Wrapped "Reset password" action into an action group. * Removed "use Illuminate\Http\Request;" as it was not needed. * Added password reset link translations. Enabled account expiry extension in actions group. Show singular message when a single user is extended. * German translation correction.
- Loading branch information
1 parent
ffabc67
commit 5e47123
Showing
9 changed files
with
89 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ | |
}); | ||
} | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace Chiiya\FilamentAccessControl\Services; | ||
|
||
use Chiiya\FilamentAccessControl\Models\FilamentUser; | ||
use Filament\Facades\Filament; | ||
use Illuminate\Support\Facades\Password; | ||
use Filament\Notifications\Auth\ResetPassword as ResetPasswordNotification; | ||
use Filament\Notifications\Notification; | ||
use Exception; | ||
|
||
class PasswordResetService | ||
{ | ||
public function sendResetLink(FilamentUser $user) | ||
{ | ||
try { | ||
$token = Password::broker('filament')->createToken($user); | ||
|
||
// Create the notification and set the URL | ||
$notification = new ResetPasswordNotification($token); | ||
$notification->url = Filament::getResetPasswordUrl($token, $user); | ||
|
||
// Send the notification | ||
$user->notify($notification); | ||
|
||
Notification::make() | ||
->title(__('filament-access-control::default.messages.password_reset_link_sent')) | ||
->success() | ||
->send(); | ||
} catch (Exception $e) { | ||
Notification::make() | ||
->title($e->getMessage()) | ||
->danger() | ||
->send(); | ||
} | ||
} | ||
} |