Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(librarium): added Password Reset button
Browse files Browse the repository at this point in the history
MathewEm authored and vincentauger committed Dec 30, 2024
1 parent a71ca33 commit 6ddde08
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/Filament/Resources/UserResource.php
Original file line number Diff line number Diff line change
@@ -54,7 +54,10 @@ public static function form(Form $form): Form
Forms\Components\Actions\Action::make('verify_email')
->label('Activate & Verify')
->hidden(fn ($record) => $record && $record->email_verified_at)
->action('setVerifiedEmail'),
->action('setVerifiedEmail'),
Forms\Components\Actions\Action::make('reset_password')
->label('Send Password Reset Email')
->action('sendPasswordReset'),
]),
]),
]);
6 changes: 6 additions & 0 deletions app/Filament/Resources/UserResource/Pages/EditUser.php
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
use App\Filament\Resources\UserResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Support\Facades\Password;

class EditUser extends EditRecord
{
@@ -62,4 +63,9 @@ public function setVerifiedEmail(): void
$this->record->markEmailAsVerified();
$this->refreshFormData(['active']);
}

public function sendPasswordReset(): void
{
Password::sendResetLink(['email' => $this->data['email']]);
}
}

0 comments on commit 6ddde08

Please sign in to comment.