fix user create and delete handling (#4818)
This commit is contained in:
+6
-4
@@ -782,12 +782,14 @@ func DeleteUser(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
err = model.HardDeleteUserById(id)
|
err = model.HardDeleteUserById(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
common.ApiError(c, err)
|
||||||
"success": true,
|
|
||||||
"message": "",
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"success": true,
|
||||||
|
"message": "",
|
||||||
|
})
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeleteSelf(c *gin.Context) {
|
func DeleteSelf(c *gin.Context) {
|
||||||
|
|||||||
@@ -121,6 +121,17 @@ export function UsersMutateDrawer({
|
|||||||
const currentQuotaRaw = form.watch('quota_dollars') || 0
|
const currentQuotaRaw = form.watch('quota_dollars') || 0
|
||||||
|
|
||||||
const onSubmit = async (data: UserFormValues) => {
|
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)
|
setIsSubmitting(true)
|
||||||
try {
|
try {
|
||||||
const payload = transformFormDataToPayload(data, currentRow?.id)
|
const payload = transformFormDataToPayload(data, currentRow?.id)
|
||||||
|
|||||||
Reference in New Issue
Block a user