注册功能及页面
This commit is contained in:
parent
bb5f136025
commit
9cd69109f9
|
|
@ -45,7 +45,7 @@ public class SysDeptController extends BaseController
|
||||||
return prefix + "/dept";
|
return prefix + "/dept";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:dept:list")
|
// @RequiresPermissions("system:dept:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<SysDept> list(SysDept dept)
|
public List<SysDept> list(SysDept dept)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ghy.web.controller.system;
|
package com.ghy.web.controller.system;
|
||||||
|
|
||||||
|
import com.ghy.common.core.domain.dto.SysUserAddDTO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
@ -12,6 +13,8 @@ import com.ghy.common.utils.StringUtils;
|
||||||
import com.ghy.framework.shiro.service.SysRegisterService;
|
import com.ghy.framework.shiro.service.SysRegisterService;
|
||||||
import com.ghy.system.service.ISysConfigService;
|
import com.ghy.system.service.ISysConfigService;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册验证
|
* 注册验证
|
||||||
*
|
*
|
||||||
|
|
@ -34,13 +37,13 @@ public class SysRegisterController extends BaseController
|
||||||
|
|
||||||
@PostMapping("/register")
|
@PostMapping("/register")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult ajaxRegister(SysUser user)
|
public AjaxResult ajaxRegister(@Valid SysUserAddDTO userAddDTO)
|
||||||
{
|
{
|
||||||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
// if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
||||||
{
|
// {
|
||||||
return error("当前系统没有开启注册功能!");
|
// return error("当前系统没有开启注册功能!");
|
||||||
}
|
// }
|
||||||
String msg = registerService.register(user);
|
String msg = registerService.register(userAddDTO);
|
||||||
return StringUtils.isEmpty(msg) ? success() : error(msg);
|
return StringUtils.isEmpty(msg) ? success() : error(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,41 @@ $(function() {
|
||||||
var url = ctx + "captcha/captchaImage?type=" + captchaType + "&s=" + Math.random();
|
var url = ctx + "captcha/captchaImage?type=" + captchaType + "&s=" + Math.random();
|
||||||
$(".imgcode").attr("src", url);
|
$(".imgcode").attr("src", url);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
dataType:"json",
|
||||||
|
url: ctx + "system/dept/list",
|
||||||
|
data: { parentId: 100 },
|
||||||
|
success: function (data) {
|
||||||
|
$.each(data, function (index, value) {
|
||||||
|
$('#deptId').append("<option value=" + value.deptId + ">" + value.deptName + "</option>");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// $('#deptId').select2({
|
||||||
|
// placeholder: '请选择公司编码',
|
||||||
|
// minimumResultsForSearch: -1,
|
||||||
|
// ajax: {
|
||||||
|
// type: "POST",
|
||||||
|
// dataType:"json",
|
||||||
|
// url: ctx + "system/dept/list",
|
||||||
|
// data: { parentId: 100 },
|
||||||
|
// processResults: function (data) {
|
||||||
|
// var processedData = [];
|
||||||
|
// $.each(data, function (index, value) {
|
||||||
|
// processedData.push({
|
||||||
|
// id: value.deptId,
|
||||||
|
// text: value.deptName
|
||||||
|
// })
|
||||||
|
// });
|
||||||
|
// return {
|
||||||
|
// results: processedData
|
||||||
|
// };
|
||||||
|
// },
|
||||||
|
// cache: true
|
||||||
|
// }
|
||||||
|
// });
|
||||||
});
|
});
|
||||||
|
|
||||||
$.validator.setDefaults({
|
$.validator.setDefaults({
|
||||||
|
|
@ -16,6 +51,8 @@ $.validator.setDefaults({
|
||||||
function register() {
|
function register() {
|
||||||
$.modal.loading($("#btnSubmit").data("loading"));
|
$.modal.loading($("#btnSubmit").data("loading"));
|
||||||
var username = $.common.trim($("input[name='username']").val());
|
var username = $.common.trim($("input[name='username']").val());
|
||||||
|
var phonenumber = $.common.trim($("input[name='phonenumber']").val());
|
||||||
|
var deptId = $.common.trim($('#deptId').val());
|
||||||
var password = $.common.trim($("input[name='password']").val());
|
var password = $.common.trim($("input[name='password']").val());
|
||||||
var validateCode = $("input[name='validateCode']").val();
|
var validateCode = $("input[name='validateCode']").val();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
@ -23,6 +60,8 @@ function register() {
|
||||||
url: ctx + "register",
|
url: ctx + "register",
|
||||||
data: {
|
data: {
|
||||||
"loginName": username,
|
"loginName": username,
|
||||||
|
"phonenumber": phonenumber,
|
||||||
|
"deptId": deptId,
|
||||||
"password": password,
|
"password": password,
|
||||||
"validateCode": validateCode
|
"validateCode": validateCode
|
||||||
},
|
},
|
||||||
|
|
@ -49,15 +88,23 @@ function register() {
|
||||||
|
|
||||||
function validateRule() {
|
function validateRule() {
|
||||||
var icon = "<i class='fa fa-times-circle'></i> ";
|
var icon = "<i class='fa fa-times-circle'></i> ";
|
||||||
|
$.validator.addMethod("checkPhone",function(value,element,params){
|
||||||
|
var regex = /^1[345678]\d{9}$/;
|
||||||
|
return regex.test(value);
|
||||||
|
}, "请输入正确的手机号码");
|
||||||
$("#registerForm").validate({
|
$("#registerForm").validate({
|
||||||
rules: {
|
rules: {
|
||||||
username: {
|
username: {
|
||||||
required: true,
|
required: true,
|
||||||
minlength: 2
|
rangelength: [2,20]
|
||||||
|
},
|
||||||
|
phonenumber: {
|
||||||
|
required: true,
|
||||||
|
checkPhone: true
|
||||||
},
|
},
|
||||||
password: {
|
password: {
|
||||||
required: true,
|
required: true,
|
||||||
minlength: 5
|
rangelength: [5,20]
|
||||||
},
|
},
|
||||||
confirmPassword: {
|
confirmPassword: {
|
||||||
required: true,
|
required: true,
|
||||||
|
|
@ -66,15 +113,18 @@ function validateRule() {
|
||||||
},
|
},
|
||||||
messages: {
|
messages: {
|
||||||
username: {
|
username: {
|
||||||
required: icon + "请输入您的用户名",
|
required: icon + "请输入用户名",
|
||||||
minlength: icon + "用户名不能小于2个字符"
|
rangelength: icon + "账户长度必须在2到20个字符之间"
|
||||||
|
},
|
||||||
|
phonenumber: {
|
||||||
|
required: icon + "请输入手机号码"
|
||||||
},
|
},
|
||||||
password: {
|
password: {
|
||||||
required: icon + "请输入您的密码",
|
required: icon + "请输入密码",
|
||||||
minlength: icon + "密码不能小于5个字符",
|
rangelength: icon + "密码长度必须在5到20个字符之间"
|
||||||
},
|
},
|
||||||
confirmPassword: {
|
confirmPassword: {
|
||||||
required: icon + "请再次输入您的密码",
|
required: icon + "请再次输入密码",
|
||||||
equalTo: icon + "两次密码输入不一致"
|
equalTo: icon + "两次密码输入不一致"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,8 @@
|
||||||
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 在你需要的时候</li>
|
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 在你需要的时候</li>
|
||||||
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 总在您身边</li>
|
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 总在您身边</li>
|
||||||
</ul>
|
</ul>
|
||||||
<strong th:if="${isAllowRegister}">还没有账号? <a th:href="@{/register}">立即注册»</a></strong>
|
<!-- <strong th:if="${isAllowRegister}">还没有账号? <a th:href="@{/register}">立即注册»</a></strong>-->
|
||||||
|
<strong>还没有账号? <a th:href="@{/register}">立即注册»</a></strong>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-5">
|
<div class="col-sm-5">
|
||||||
|
|
|
||||||
|
|
@ -15,25 +15,22 @@
|
||||||
<!-- 避免IE使用兼容模式 -->
|
<!-- 避免IE使用兼容模式 -->
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<link rel="shortcut icon" href="../static/favicon.ico" th:href="@{favicon.ico}"/>
|
<link rel="shortcut icon" href="../static/favicon.ico" th:href="@{favicon.ico}"/>
|
||||||
<style type="text/css">label.error { position:inherit; }</style>
|
<style type="text/css">
|
||||||
|
label.error { position:inherit; }
|
||||||
|
#registerForm input,
|
||||||
|
#registerForm select {
|
||||||
|
color: black
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<th:block th:include="include :: select2-css" />
|
||||||
</head>
|
</head>
|
||||||
<body class="signin">
|
<body class="signin">
|
||||||
<div class="signinpanel">
|
<div class="signinpanel">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-7">
|
<div class="col-sm-7">
|
||||||
<div class="signin-info">
|
<div class="signin-info">
|
||||||
<div class="logopanel m-b">
|
|
||||||
<h1><img alt="[ 工圈子 ]" src="../static/ruoyi.png" th:src="@{/ruoyi.png}"></h1>
|
|
||||||
</div>
|
|
||||||
<div class="m-b"></div>
|
<div class="m-b"></div>
|
||||||
<h4>欢迎使用 <strong>工圈子 后台管理系统</strong></h4>
|
<h4>欢迎使用 <strong>工圈子 后台管理系统</strong></h4>
|
||||||
<ul class="m-b">
|
|
||||||
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> SpringBoot</li>
|
|
||||||
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Mybatis</li>
|
|
||||||
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Shiro</li>
|
|
||||||
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Thymeleaf</li>
|
|
||||||
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Bootstrap</li>
|
|
||||||
</ul>
|
|
||||||
<strong>已经注册过? <a th:href="@{/login}">直接登录»</a></strong>
|
<strong>已经注册过? <a th:href="@{/login}">直接登录»</a></strong>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -41,9 +38,13 @@
|
||||||
<form id="registerForm" autocomplete="off">
|
<form id="registerForm" autocomplete="off">
|
||||||
<h4 class="no-margins">注册:</h4>
|
<h4 class="no-margins">注册:</h4>
|
||||||
<p class="m-t-md">你若不离不弃,我必生死相依</p>
|
<p class="m-t-md">你若不离不弃,我必生死相依</p>
|
||||||
<input type="text" name="username" class="form-control uname" placeholder="用户名" maxlength="20" />
|
<input type="text" name="username" class="form-control username" placeholder="用户名"/>
|
||||||
<input type="password" name="password" class="form-control pword" placeholder="密码" maxlength="20" />
|
<input type="text" name="phonenumber" class="form-control phonenumber" placeholder="手机号"/>
|
||||||
<input type="password" name="confirmPassword" class="form-control pword" placeholder="确认密码" maxlength="20" />
|
<select id="deptId" class="form-control" name="deptId">
|
||||||
|
<option value="" selected>请选择公司编码</option>
|
||||||
|
</select>
|
||||||
|
<input type="password" name="password" class="form-control pword" placeholder="密码"/>
|
||||||
|
<input type="password" name="confirmPassword" class="form-control pword" placeholder="确认密码"/>
|
||||||
<div class="row m-t" th:if="${captchaEnabled==true}">
|
<div class="row m-t" th:if="${captchaEnabled==true}">
|
||||||
<div class="col-xs-6">
|
<div class="col-xs-6">
|
||||||
<input type="text" name="validateCode" class="form-control code" placeholder="验证码" maxlength="5" >
|
<input type="text" name="validateCode" class="form-control code" placeholder="验证码" maxlength="5" >
|
||||||
|
|
@ -54,17 +55,18 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox-custom" th:classappend="${captchaEnabled==false} ? 'm-t'">
|
<!-- <div class="checkbox-custom" th:classappend="${captchaEnabled==false} ? 'm-t'">-->
|
||||||
<input type="checkbox" id="acceptTerm" name="acceptTerm"> <label for="acceptTerm">我已阅读并同意</label>
|
<!-- <input type="checkbox" id="acceptTerm" name="acceptTerm"> <label for="acceptTerm">我已阅读并同意</label>-->
|
||||||
<a href="https://gitee.com/y_project/RuoYi/blob/master/README.md" target="_blank">使用条款</a>
|
<!-- <a href="https://gitee.com/y_project/RuoYi/blob/master/README.md" target="_blank">使用条款</a>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<button class="btn btn-success btn-block" id="btnSubmit" data-loading="正在验证注册,请稍候...">注册</button>
|
<button class="btn btn-success btn-block" id="btnSubmit" data-loading="正在验证注册,请稍候...">注册</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="signup-footer">
|
<div class="signup-footer">
|
||||||
<div class="pull-left">
|
<div class="pull-left">
|
||||||
© 2018-2021 All Rights Reserved. RuoYi <br>
|
Copyright © 2018-2021 opsoul.com All Rights Reserved. <br>
|
||||||
|
备案号 粤ICP备2021044349号-1
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -76,5 +78,6 @@
|
||||||
<script src="../static/ajax/libs/blockUI/jquery.blockUI.js" th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>
|
<script src="../static/ajax/libs/blockUI/jquery.blockUI.js" th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>
|
||||||
<script src="../static/ruoyi/js/ry-ui.js" th:src="@{/ruoyi/js/ry-ui.js?v=4.7.2}"></script>
|
<script src="../static/ruoyi/js/ry-ui.js" th:src="@{/ruoyi/js/ry-ui.js?v=4.7.2}"></script>
|
||||||
<script src="../static/ruoyi/register.js" th:src="@{/ruoyi/register.js}"></script>
|
<script src="../static/ruoyi/register.js" th:src="@{/ruoyi/register.js}"></script>
|
||||||
|
<th:block th:include="include :: select2-js" />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.ghy.common.core.domain.dto;
|
||||||
|
|
||||||
|
import com.ghy.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description:
|
||||||
|
* @author: yangdanqi
|
||||||
|
* @date: 2023/7/1
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysUserAddDTO extends BaseEntity {
|
||||||
|
@NotNull(message = "公司编码不能为空")
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
@NotBlank(message = "账号不能为空")
|
||||||
|
@Length(min = 2, max = 20, message = "账户长度必须在2到20个字符之间")
|
||||||
|
private String loginName;
|
||||||
|
|
||||||
|
@NotBlank(message = "手机号码不能为空")
|
||||||
|
@Pattern(regexp = "^1[345678]\\d{9}$", message = "手机号码格式不正确")
|
||||||
|
private String phonenumber;
|
||||||
|
|
||||||
|
@NotBlank(message = "密码不能为空")
|
||||||
|
@Length(min = 5, max = 20, message = "密码长度必须在5到20个字符之间")
|
||||||
|
private String password;
|
||||||
|
}
|
||||||
|
|
@ -287,6 +287,7 @@ public class ShiroConfig
|
||||||
filterChainDefinitionMap.put("/tool/**", "anon");
|
filterChainDefinitionMap.put("/tool/**", "anon");
|
||||||
filterChainDefinitionMap.put("/adapay/**", "anon");
|
filterChainDefinitionMap.put("/adapay/**", "anon");
|
||||||
filterChainDefinitionMap.put("/system/area/**", "anon");
|
filterChainDefinitionMap.put("/system/area/**", "anon");
|
||||||
|
filterChainDefinitionMap.put("/system/dept/list", "anon");
|
||||||
filterChainDefinitionMap.put("/customer/address/**", "anon");
|
filterChainDefinitionMap.put("/customer/address/**", "anon");
|
||||||
filterChainDefinitionMap.put("/customer/place/app/**", "anon");
|
filterChainDefinitionMap.put("/customer/place/app/**", "anon");
|
||||||
filterChainDefinitionMap.put("/customer/selection/app/**", "anon");
|
filterChainDefinitionMap.put("/customer/selection/app/**", "anon");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.ghy.framework.shiro.service;
|
package com.ghy.framework.shiro.service;
|
||||||
|
|
||||||
|
import com.ghy.common.core.domain.dto.SysUserAddDTO;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import com.ghy.common.constant.Constants;
|
import com.ghy.common.constant.Constants;
|
||||||
|
|
@ -10,10 +12,10 @@ import com.ghy.common.utils.DateUtils;
|
||||||
import com.ghy.common.utils.MessageUtils;
|
import com.ghy.common.utils.MessageUtils;
|
||||||
import com.ghy.common.utils.ServletUtils;
|
import com.ghy.common.utils.ServletUtils;
|
||||||
import com.ghy.common.utils.ShiroUtils;
|
import com.ghy.common.utils.ShiroUtils;
|
||||||
import com.ghy.common.utils.StringUtils;
|
|
||||||
import com.ghy.framework.manager.AsyncManager;
|
import com.ghy.framework.manager.AsyncManager;
|
||||||
import com.ghy.framework.manager.factory.AsyncFactory;
|
import com.ghy.framework.manager.factory.AsyncFactory;
|
||||||
import com.ghy.system.service.ISysUserService;
|
import com.ghy.system.service.ISysUserService;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册校验方法
|
* 注册校验方法
|
||||||
|
|
@ -32,50 +34,30 @@ public class SysRegisterService
|
||||||
/**
|
/**
|
||||||
* 注册
|
* 注册
|
||||||
*/
|
*/
|
||||||
public String register(SysUser user)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
{
|
public String register(SysUserAddDTO userAddDTO) {
|
||||||
String msg = "", loginName = user.getLoginName(), password = user.getPassword();
|
String msg = "";
|
||||||
|
SysUser sysUser = new SysUser();
|
||||||
|
BeanUtils.copyProperties(userAddDTO, sysUser);
|
||||||
|
|
||||||
if (ShiroConstants.CAPTCHA_ERROR.equals(ServletUtils.getRequest().getAttribute(ShiroConstants.CURRENT_CAPTCHA)))
|
if (ShiroConstants.CAPTCHA_ERROR.equals(ServletUtils.getRequest().getAttribute(ShiroConstants.CURRENT_CAPTCHA))) {
|
||||||
{
|
|
||||||
msg = "验证码错误";
|
msg = "验证码错误";
|
||||||
}
|
} else if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(sysUser.getLoginName()))) {
|
||||||
else if (StringUtils.isEmpty(loginName))
|
msg = "保存用户'" + userAddDTO.getLoginName() + "'失败,注册账号已存在";
|
||||||
{
|
} else if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkPhoneUnique(sysUser))) {
|
||||||
msg = "用户名不能为空";
|
msg = "保存手机号码'" + userAddDTO.getPhonenumber() + "'失败,该手机号码已被注册";
|
||||||
}
|
} else {
|
||||||
else if (StringUtils.isEmpty(password))
|
sysUser.setPwdUpdateDate(DateUtils.getNowDate());
|
||||||
{
|
sysUser.setUserName(userAddDTO.getLoginName());
|
||||||
msg = "用户密码不能为空";
|
sysUser.setSalt(ShiroUtils.randomSalt());
|
||||||
}
|
sysUser.setPassword(passwordService.encryptPassword(sysUser.getLoginName(), sysUser.getPassword(), sysUser.getSalt()));
|
||||||
else if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|
boolean regFlag = userService.registerUser(sysUser);
|
||||||
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH)
|
SysUser registeredUserInfo = userService.selectUserByLoginName(sysUser.getLoginName());
|
||||||
{
|
userService.insertUserAuth(registeredUserInfo.getUserId(), new Long[]{101l});
|
||||||
msg = "密码长度必须在5到20个字符之间";
|
if (!regFlag) {
|
||||||
}
|
|
||||||
else if (loginName.length() < UserConstants.USERNAME_MIN_LENGTH
|
|
||||||
|| loginName.length() > UserConstants.USERNAME_MAX_LENGTH)
|
|
||||||
{
|
|
||||||
msg = "账户长度必须在2到20个字符之间";
|
|
||||||
}
|
|
||||||
else if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(loginName)))
|
|
||||||
{
|
|
||||||
msg = "保存用户'" + loginName + "'失败,注册账号已存在";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
user.setPwdUpdateDate(DateUtils.getNowDate());
|
|
||||||
user.setUserName(loginName);
|
|
||||||
user.setSalt(ShiroUtils.randomSalt());
|
|
||||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
|
||||||
boolean regFlag = userService.registerUser(user);
|
|
||||||
if (!regFlag)
|
|
||||||
{
|
|
||||||
msg = "注册失败,请联系系统管理人员";
|
msg = "注册失败,请联系系统管理人员";
|
||||||
}
|
} else {
|
||||||
else
|
AsyncManager.me().execute(AsyncFactory.recordLogininfor(userAddDTO.getLoginName(), Constants.REGISTER, MessageUtils.message("user.register.success")));
|
||||||
{
|
|
||||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.REGISTER, MessageUtils.message("user.register.success")));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return msg;
|
return msg;
|
||||||
|
|
|
||||||
|
|
@ -138,11 +138,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkLoginNameUnique" parameterType="String" resultType="int">
|
<select id="checkLoginNameUnique" parameterType="String" resultType="int">
|
||||||
select count(1) from sys_user where login_name=#{loginName} limit 1
|
select count(1) from sys_user where login_name=#{loginName} and del_flag = 0 limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
|
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
|
||||||
select user_id, phonenumber from sys_user where phonenumber=#{phonenumber} limit 1
|
select user_id, phonenumber from sys_user where phonenumber=#{phonenumber} and del_flag = 0 limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue