Skip to content

Commit

Permalink
Update UserPasswordLayout.php (#2916)
Browse files Browse the repository at this point in the history
Added required for password input.

Without calling the method, the user may not always notice that it is necessary to add a password when creating a new user in the platform. This leads to a 500 error "Field 'password' doesn't have a default value"
  • Loading branch information
bald-cat authored Oct 31, 2024
1 parent 288cfec commit ece4c3b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions stubs/app/Orchid/Layouts/User/UserPasswordLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ public function fields(): array
/** @var User $user */
$user = $this->query->get('user');

$placeholder = $user->exists
$exists = $user->exists;

$placeholder = $exists
? __('Leave empty to keep current password')
: __('Enter the password to be set');

return [
Password::make('user.password')
->placeholder($placeholder)
->title(__('Password')),
->title(__('Password'))
->required(!$exists),
];
}
}

0 comments on commit ece4c3b

Please sign in to comment.