Seebad 0.3 stays in this release. With a single landlord every host still reaches the default website. Co-authored-by: Cursor <cursoragent@cursor.com>
39 lines
940 B
PHP
39 lines
940 B
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Users\Pages;
|
|
|
|
use App\Filament\Resources\Users\UserResource;
|
|
use App\Models\User;
|
|
use Filament\Actions\DeleteAction;
|
|
use Filament\Resources\Pages\EditRecord;
|
|
|
|
class EditUser extends EditRecord
|
|
{
|
|
protected static string $resource = UserResource::class;
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
DeleteAction::make(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* A hidden password field must not be writable by a crafted request either.
|
|
*
|
|
* @param array<string, mixed> $data
|
|
* @return array<string, mixed>
|
|
*/
|
|
protected function mutateFormDataBeforeSave(array $data): array
|
|
{
|
|
$actor = auth()->user();
|
|
$record = $this->getRecord();
|
|
|
|
if (! $actor instanceof User || ! $record instanceof User || ! $actor->mayResetCredentials($record)) {
|
|
unset($data['password']);
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
}
|