feat: Implement custom system notification for profile updates and track password changes.
This commit is contained in:
parent
515526b478
commit
7c091ba50c
@ -2,9 +2,11 @@
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Filament\Support\SystemNotification;
|
||||
use Filament\Auth\Pages\EditProfile;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Schema;
|
||||
@ -14,6 +16,8 @@
|
||||
|
||||
class Profile extends EditProfile
|
||||
{
|
||||
protected bool $hasPasswordChanged = false;
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
@ -92,6 +96,11 @@ public function form(Schema $schema): Schema
|
||||
]);
|
||||
}
|
||||
|
||||
protected function getSavedNotification(): ?Notification
|
||||
{
|
||||
return SystemNotification::update();
|
||||
}
|
||||
|
||||
protected function handleRecordUpdate(Model $record, array $data): Model
|
||||
{
|
||||
$shouldLogout = false;
|
||||
@ -99,6 +108,7 @@ protected function handleRecordUpdate(Model $record, array $data): Model
|
||||
$data['password'] = $data['new_password'];
|
||||
unset($data['new_password']);
|
||||
$shouldLogout = true;
|
||||
$this->hasPasswordChanged = true;
|
||||
}
|
||||
|
||||
$record->update($data);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user