mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-29 08:34:45 +02:00
Update unique, remove dehydrates
This commit is contained in:
parent
12af8fe51e
commit
cca723d21e
@ -87,13 +87,15 @@ class ListUsers extends ListRecords
|
|||||||
->alphaNum()
|
->alphaNum()
|
||||||
->required()
|
->required()
|
||||||
->maxLength(191),
|
->maxLength(191),
|
||||||
Forms\Components\TextInput::make('email')->email()->required()->maxLength(191),
|
Forms\Components\TextInput::make('email')
|
||||||
|
->email()
|
||||||
|
->required()
|
||||||
|
->unique()
|
||||||
|
->maxLength(191),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('password')
|
Forms\Components\TextInput::make('password')
|
||||||
->hintIcon('tabler-question-mark')
|
->hintIcon('tabler-question-mark')
|
||||||
->hintIconTooltip('Providing a user password is optional. New user email will prompt users to create a password the first time they login.')
|
->hintIconTooltip('Providing a user password is optional. New user email will prompt users to create a password the first time they login.')
|
||||||
->dehydrateStateUsing(fn (string $state): string => Hash::make($state))
|
|
||||||
->dehydrated(fn (?string $state): bool => filled($state))
|
|
||||||
->password(),
|
->password(),
|
||||||
|
|
||||||
Forms\Components\ToggleButtons::make('root_admin')
|
Forms\Components\ToggleButtons::make('root_admin')
|
||||||
@ -106,13 +108,6 @@ class ListUsers extends ListRecords
|
|||||||
false => 'primary',
|
false => 'primary',
|
||||||
true => 'danger',
|
true => 'danger',
|
||||||
])
|
])
|
||||||
->disableOptionWhen(function (string $operation, $value, User $user) {
|
|
||||||
if ($operation !== 'edit' || $value) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $user->isLastRootAdmin();
|
|
||||||
})
|
|
||||||
->hint(fn (User $user) => $user->isLastRootAdmin() ? 'This is the last root administrator!' : '')
|
->hint(fn (User $user) => $user->isLastRootAdmin() ? 'This is the last root administrator!' : '')
|
||||||
->helperText(fn (User $user) => $user->isLastRootAdmin() ? 'You must have at least one root administrator in your system.' : '')
|
->helperText(fn (User $user) => $user->isLastRootAdmin() ? 'You must have at least one root administrator in your system.' : '')
|
||||||
->hintColor('warning')
|
->hintColor('warning')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user