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;
|
namespace App\Filament\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Support\SystemNotification;
|
||||||
use Filament\Auth\Pages\EditProfile;
|
use Filament\Auth\Pages\EditProfile;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Schemas\Components\Section;
|
use Filament\Schemas\Components\Section;
|
||||||
use Filament\Schemas\Components\Utilities\Get;
|
use Filament\Schemas\Components\Utilities\Get;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
@ -14,6 +16,8 @@
|
|||||||
|
|
||||||
class Profile extends EditProfile
|
class Profile extends EditProfile
|
||||||
{
|
{
|
||||||
|
protected bool $hasPasswordChanged = false;
|
||||||
|
|
||||||
public function form(Schema $schema): Schema
|
public function form(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
return $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
|
protected function handleRecordUpdate(Model $record, array $data): Model
|
||||||
{
|
{
|
||||||
$shouldLogout = false;
|
$shouldLogout = false;
|
||||||
@ -99,6 +108,7 @@ protected function handleRecordUpdate(Model $record, array $data): Model
|
|||||||
$data['password'] = $data['new_password'];
|
$data['password'] = $data['new_password'];
|
||||||
unset($data['new_password']);
|
unset($data['new_password']);
|
||||||
$shouldLogout = true;
|
$shouldLogout = true;
|
||||||
|
$this->hasPasswordChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$record->update($data);
|
$record->update($data);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user