diff --git a/resources/js/features/user-edit/UserCreateForm.tsx b/resources/js/features/user-edit/UserCreateForm.tsx index 01cb04228..4b98fa47c 100644 --- a/resources/js/features/user-edit/UserCreateForm.tsx +++ b/resources/js/features/user-edit/UserCreateForm.tsx @@ -43,10 +43,9 @@ export const UserCreateForm: VoidComponent = (props) => { ? { email: values.email, hasEmailVerified: values.hasEmailVerified, - hasPassword: values.hasPassword, - ...(values.hasPassword && values.password - ? {password: values.password, passwordExpireAt} - : {password: null, passwordExpireAt}), + ...(values.hasPassword + ? {hasPassword: true, password: values.password, passwordExpireAt} + : {hasPassword: false, password: null, passwordExpireAt: null}), } : { email: null, diff --git a/resources/js/features/user-edit/UserEditForm.tsx b/resources/js/features/user-edit/UserEditForm.tsx index e962cef9b..6588323e8 100644 --- a/resources/js/features/user-edit/UserEditForm.tsx +++ b/resources/js/features/user-edit/UserEditForm.tsx @@ -74,14 +74,13 @@ export const UserEditForm: VoidComponent = (props) => { ? { email: values.email, hasEmailVerified: values.hasEmailVerified, - hasPassword: values.hasPassword, ...(values.hasPassword ? oldUser.hasPassword && !values.password ? // The user has a password already and it is not changed. - {passwordExpireAt} + {hasPassword: true, passwordExpireAt} : // New password or a password change. - {password: values.password, passwordExpireAt} - : {password: null, passwordExpireAt}), + {hasPassword: true, password: values.password, passwordExpireAt} + : {hasPassword: false, password: null, passwordExpireAt: null}), } : { email: null,