|
@@ -1,9 +1,11 @@
|
|
package com.sooka.web.controller.system;
|
|
package com.sooka.web.controller.system;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.regex.Pattern;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import com.business.slfh.tools.PinYinUtil;
|
|
import com.business.slfh.tools.PinYinUtil;
|
|
|
|
+import com.sooka.system.mapper.SysUserMapper;
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
@@ -30,6 +32,8 @@ import com.sooka.system.service.ISysPostService;
|
|
import com.sooka.system.service.ISysRoleService;
|
|
import com.sooka.system.service.ISysRoleService;
|
|
import com.sooka.system.service.ISysUserService;
|
|
import com.sooka.system.service.ISysUserService;
|
|
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 用户信息
|
|
* 用户信息
|
|
*
|
|
*
|
|
@@ -131,6 +135,14 @@ public class SysUserController extends BaseController
|
|
{
|
|
{
|
|
return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
|
return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //校验用户密码
|
|
|
|
+ String pattern = "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_]+$)(?![a-z0-9]+$)(?![a-z\\W_]+$)(?![0-9\\W_]+$)[a-zA-Z0-9\\W_]{8,}$";
|
|
|
|
+ boolean isMatch = Pattern.matches(pattern, user.getPassword());
|
|
|
|
+ if(!isMatch){
|
|
|
|
+ return error("密码必须包含大小写字母数组和特殊符号!");
|
|
|
|
+ }
|
|
|
|
+
|
|
// else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
|
// else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
|
// {
|
|
// {
|
|
// return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
|
// return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
|
@@ -188,6 +200,7 @@ public class SysUserController extends BaseController
|
|
@GetMapping("/resetPwd/{userId}")
|
|
@GetMapping("/resetPwd/{userId}")
|
|
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
|
|
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
|
|
{
|
|
{
|
|
|
|
+
|
|
mmap.put("user", userService.selectUserById(userId));
|
|
mmap.put("user", userService.selectUserById(userId));
|
|
return prefix + "/resetPwd";
|
|
return prefix + "/resetPwd";
|
|
}
|
|
}
|
|
@@ -207,17 +220,29 @@ public class SysUserController extends BaseController
|
|
{
|
|
{
|
|
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
|
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
|
}
|
|
}
|
|
|
|
+ //校验用户密码
|
|
|
|
+ String pattern = "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_]+$)(?![a-z0-9]+$)(?![a-z\\W_]+$)(?![0-9\\W_]+$)[a-zA-Z0-9\\W_]{8,}$";
|
|
|
|
+ boolean isMatch = Pattern.matches(pattern, user.getPassword());
|
|
|
|
+ if(!isMatch){
|
|
|
|
+ return error("密码必须包含大小写字母数组和特殊符号!");
|
|
|
|
+ }
|
|
return success();
|
|
return success();
|
|
}
|
|
}
|
|
return error();
|
|
return error();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ SysUserMapper sysUserMapper;
|
|
|
|
+
|
|
@RequestMapping("resetPwdBatch")
|
|
@RequestMapping("resetPwdBatch")
|
|
|
|
+ @ResponseBody
|
|
public AjaxResult resetPwdBatch(){
|
|
public AjaxResult resetPwdBatch(){
|
|
List<SysUser> list = userService.selectUserList(new SysUser());
|
|
List<SysUser> list = userService.selectUserList(new SysUser());
|
|
for(SysUser s : list){
|
|
for(SysUser s : list){
|
|
s.setSalt(ShiroUtils.randomSalt());
|
|
s.setSalt(ShiroUtils.randomSalt());
|
|
- s.setPassword(passwordService.encryptPassword(s.getLoginName(), "AbCd"+s.getPhonenumber(), s.getSalt()));
|
|
|
|
|
|
+ s.setPassword(passwordService.encryptPassword(s.getLoginName(), "AbCd%"+s.getPhonenumber(), s.getSalt()));
|
|
|
|
+ s.setUserId(s.getUserId());
|
|
|
|
+ sysUserMapper.updateUser(s);
|
|
}
|
|
}
|
|
return success();
|
|
return success();
|
|
}
|
|
}
|