fix(admin): 修复新增管理员无角色后不可见

This commit is contained in:
yml
2026-11-17 18:02:22 +08:00
parent ab68cce595
commit 8620d0a733
7 changed files with 175 additions and 18 deletions
@@ -175,6 +175,14 @@ func writeError(c *gin.Context, err error) {
response.BadRequest(c, "原密码错误")
case errors.Is(err, ErrWeakPassword):
response.BadRequest(c, "密码至少 8 位且需包含字母和数字")
case errors.Is(err, ErrUsernameRequired):
response.BadRequest(c, "用户名不能为空")
case errors.Is(err, ErrRolesRequired):
response.BadRequest(c, "请至少选择一个角色")
case errors.Is(err, ErrRoleOutsideTenant):
response.BadRequest(c, "角色不属于当前站点")
case errors.Is(err, ErrUsernameExists):
response.Error(c, http.StatusConflict, "username_exists", "用户名已存在,请更换用户名")
case IsNotFound(err):
response.Error(c, http.StatusNotFound, "not_found", "管理员不存在")
default: