mirror of https://gitee.com/y_project/RuoYi.git
后台校验登录账户不能重复
parent
49001edac8
commit
dfd65fbeb8
|
@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
@ -122,6 +123,10 @@ public class SysUserController extends BaseController
|
|||
{
|
||||
return error("不允许修改超级管理员用户");
|
||||
}
|
||||
if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName())))
|
||||
{
|
||||
return error("保存用户'" + user.getLoginName() + "'失败,登录账号已存在");
|
||||
}
|
||||
user.setSalt(ShiroUtils.randomSalt());
|
||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
||||
user.setCreateBy(ShiroUtils.getLoginName());
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<label class="col-sm-3 control-label">权限标识:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="perms" name="perms" class="form-control" type="text" th:field="*{perms}">
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 控制器中定义的权限标识,如:@RequiresPermissions("")</span>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 控制器中定义的权限标识,如:@RequiresPermissions("")</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><span style="color: red; ">*</span>用户名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="userName" autocomplete="off" placeholder="请输入用户名称" class="form-control" type="text" maxlength="30" required>
|
||||
<input name="userName" placeholder="请输入用户名称" class="form-control" type="text" maxlength="30" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><span style="color: red; ">*</span>手机号码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="phonenumber" autocomplete="off" placeholder="请输入手机号码" class="form-control" type="text" maxlength="11" required>
|
||||
<input name="phonenumber" placeholder="请输入手机号码" class="form-control" type="text" maxlength="11" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -43,7 +43,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><span style="color: red; ">*</span>邮箱:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="email" autocomplete="off" class="form-control email" type="text" maxlength="50" placeholder="请输入邮箱" required>
|
||||
<input name="email" class="form-control email" type="text" maxlength="50" placeholder="请输入邮箱" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -53,7 +53,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><span style="color: red; ">*</span>登录账号:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="loginName" placeholder="请输入登录账号" autocomplete="off" class="form-control required" type="text" maxlength="30" required>
|
||||
<input name="loginName" placeholder="请输入登录账号" class="form-control required" type="text" maxlength="30" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -61,7 +61,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><span style="color: red; ">*</span>登录密码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="password" placeholder="请输入登录密码" autocomplete="off" class="form-control" type="password" th:value="${@config.getKey('sys.user.initPassword')}" required>
|
||||
<input name="password" placeholder="请输入登录密码" class="form-control" type="password" th:value="${@config.getKey('sys.user.initPassword')}" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -121,7 +121,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-xs-2 control-label">备注:</label>
|
||||
<div class="col-xs-10">
|
||||
<textarea name="remark" autocomplete="off" maxlength="500" class="form-control" rows="3"></textarea>
|
||||
<textarea name="remark" maxlength="500" class="form-control" rows="3"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><span style="color: red; ">*</span>用户名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="userName" autocomplete="off" placeholder="请输入用户名称" class="form-control" type="text" maxlength="30" th:field="*{userName}" required>
|
||||
<input name="userName" placeholder="请输入用户名称" class="form-control" type="text" maxlength="30" th:field="*{userName}" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -36,7 +36,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><span style="color: red; ">*</span>手机号码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="phonenumber" autocomplete="off" placeholder="请输入手机号码" class="form-control" type="text" maxlength="11" th:field="*{phonenumber}" required>
|
||||
<input name="phonenumber" placeholder="请输入手机号码" class="form-control" type="text" maxlength="11" th:field="*{phonenumber}" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -44,7 +44,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><span style="color: red; ">*</span>邮箱:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="email" autocomplete="off" class="form-control email" type="text" maxlength="50" placeholder="请输入邮箱" th:field="*{email}" required>
|
||||
<input name="email" class="form-control email" type="text" maxlength="50" placeholder="请输入邮箱" th:field="*{email}" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -112,7 +112,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-xs-2 control-label">备注:</label>
|
||||
<div class="col-xs-10">
|
||||
<textarea name="remark" autocomplete="off" maxlength="500" class="form-control" rows="3">[[*{remark}]]</textarea>
|
||||
<textarea name="remark" maxlength="500" class="form-control" rows="3">[[*{remark}]]</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -64,19 +64,19 @@
|
|||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">用户名称:</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" autocomplete="off" class="form-control" name="userName" th:field="*{userName}" placeholder="请输入用户名称">
|
||||
<input type="text" class="form-control" name="userName" th:field="*{userName}" placeholder="请输入用户名称">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">手机号码:</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" autocomplete="off" class="form-control" name="phonenumber" maxlength="11" th:field="*{phonenumber}" placeholder="请输入手机号码">
|
||||
<input type="text" class="form-control" name="phonenumber" maxlength="11" th:field="*{phonenumber}" placeholder="请输入手机号码">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">邮箱:</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" autocomplete="off" class="form-control" name="email" th:field="*{email}" placeholder="请输入邮箱">
|
||||
<input type="text" class="form-control" name="email" th:field="*{email}" placeholder="请输入邮箱">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
|
@ -232,9 +232,11 @@ public class AjaxResult extends HashMap<String, Object>
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("code", getCode())
|
||||
.append("msg", getMsg()).append("data", getData()).toString();
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("code", getCode())
|
||||
.append("msg", getMsg())
|
||||
.append("data", getData())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -293,7 +293,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
}
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
* 校验登录名称是否唯一
|
||||
*
|
||||
* @param loginName 用户名
|
||||
* @return
|
||||
|
|
Loading…
Reference in New Issue