mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-04 22:41:24 +08:00
Optimized form validation
This commit is contained in:
@@ -106,6 +106,9 @@ public class UserController {
|
||||
@PreAuthorize("hasAuthority('system:user:modify')")
|
||||
@Operation(summary = "修改用户(权限管理相关)")
|
||||
public ResponseResult<User> modifyUser(@RequestBody User user) {
|
||||
if (user.getId() == 1L && user.getEnable() == 0) {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_DELETE_ERROR, "Unable to disable super admin", null);
|
||||
}
|
||||
if (!StringUtils.hasText(user.getUsername())) {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "Username cannot be empty", null);
|
||||
}
|
||||
|
||||
@@ -107,6 +107,10 @@ export default {
|
||||
{
|
||||
required: true,
|
||||
message: '用户组名称为必填项'
|
||||
},
|
||||
{
|
||||
max: 30,
|
||||
message: '用户组不能大于30个字符'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -117,6 +117,10 @@ export default {
|
||||
{
|
||||
required: true,
|
||||
message: '角色名称为必填项'
|
||||
},
|
||||
{
|
||||
max: 20,
|
||||
message: '角色名称不能大于20个字符'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
autocomplete="off"
|
||||
v-model="userForm.inputUsername"
|
||||
placeholder="请输入用户名"
|
||||
minlength="3"
|
||||
maxlength="20"
|
||||
/>
|
||||
</el-form-item>
|
||||
@@ -51,6 +52,8 @@
|
||||
autocomplete="off"
|
||||
v-model="userForm.inputPassword"
|
||||
:placeholder="isAddNew ? '请输入密码' : '留空则不修改密码'"
|
||||
minlength="8"
|
||||
maxlength="64"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="角色">
|
||||
@@ -146,12 +149,28 @@ export default {
|
||||
{
|
||||
required: true,
|
||||
message: '用户名不能为空'
|
||||
},
|
||||
{
|
||||
min: 3,
|
||||
message: '用户名必须大于3个字符'
|
||||
},
|
||||
{
|
||||
max: 20,
|
||||
message: '用户名不能大于20个字符'
|
||||
}
|
||||
],
|
||||
inputPassword: [
|
||||
{
|
||||
validator: checkPassword,
|
||||
message: '密码不能为空'
|
||||
},
|
||||
{
|
||||
min: 8,
|
||||
message: '密码必须大于8个字符'
|
||||
},
|
||||
{
|
||||
max: 64,
|
||||
message: '密码不能大于64个字符'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user