Skip to content

Commit 1fd805a

Browse files
committed
Fixed an error when creating a user with email but no password.
1 parent f58eb7b commit 1fd805a

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

resources/js/features/user-edit/UserCreateForm.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ export const UserCreateForm: VoidComponent<Props> = (props) => {
4343
? {
4444
email: values.email,
4545
hasEmailVerified: values.hasEmailVerified,
46-
hasPassword: values.hasPassword,
47-
...(values.hasPassword && values.password
48-
? {password: values.password, passwordExpireAt}
49-
: {password: null, passwordExpireAt}),
46+
...(values.hasPassword
47+
? {hasPassword: true, password: values.password, passwordExpireAt}
48+
: {hasPassword: false, password: null, passwordExpireAt: null}),
5049
}
5150
: {
5251
email: null,

resources/js/features/user-edit/UserEditForm.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,13 @@ export const UserEditForm: VoidComponent<Props> = (props) => {
7474
? {
7575
email: values.email,
7676
hasEmailVerified: values.hasEmailVerified,
77-
hasPassword: values.hasPassword,
7877
...(values.hasPassword
7978
? oldUser.hasPassword && !values.password
8079
? // The user has a password already and it is not changed.
81-
{passwordExpireAt}
80+
{hasPassword: true, passwordExpireAt}
8281
: // New password or a password change.
83-
{password: values.password, passwordExpireAt}
84-
: {password: null, passwordExpireAt}),
82+
{hasPassword: true, password: values.password, passwordExpireAt}
83+
: {hasPassword: false, password: null, passwordExpireAt: null}),
8584
}
8685
: {
8786
email: null,

0 commit comments

Comments
 (0)