Commit 8ae095c3 by Baiyuan Chiu Committed by GitHub

fix user create and delete handling (#4818)

parent 04b4483d
......@@ -782,12 +782,14 @@ func DeleteUser(c *gin.Context) {
}
err = model.HardDeleteUserById(id)
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": true,
"message": "",
})
common.ApiError(c, err)
return
}
c.JSON(http.StatusOK, gin.H{
"success": true,
"message": "",
})
return
}
func DeleteSelf(c *gin.Context) {
......
......@@ -121,6 +121,17 @@ export function UsersMutateDrawer({
const currentQuotaRaw = form.watch('quota_dollars') || 0
const onSubmit = async (data: UserFormValues) => {
if (!isUpdate) {
const passwordLength = data.password?.length || 0
if (passwordLength < 8 || passwordLength > 20) {
form.setError('password', {
type: 'manual',
message: t('Password must be between 8 and 20 characters'),
})
return
}
}
setIsSubmitting(true)
try {
const payload = transformFormDataToPayload(data, currentRow?.id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment