|
@@ -11,6 +11,7 @@ import cn.com.qmth.examcloud.commons.util.SHA256;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.controller.bean.UserDomain;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.controller.bean.UserFormDomain;
|
|
|
import cn.com.qmth.examcloud.core.basic.base.constants.BasicConsts;
|
|
|
+import cn.com.qmth.examcloud.core.basic.base.util.BaseUtil;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.RoleRepo;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
|
|
@@ -535,6 +536,11 @@ public class UserController extends ControllerSupport {
|
|
|
|
|
|
trim(userForm, true);
|
|
|
userForm.setId(null);
|
|
|
+
|
|
|
+ if(!BaseUtil.checkPassword(userForm.getPassword())){
|
|
|
+ throw new StatusException("密码至少包含大写字母、小写字母、数字、特殊符号中的三种,且长度限制在6-10位!");
|
|
|
+ }
|
|
|
+
|
|
|
Map<String, Object> ret = saveUser(userForm);
|
|
|
|
|
|
ReportsUtil.report(new AdminOperateReport(accessUser.getRootOrgId(), accessUser.getUserId(), AdminOperateType.TYPE6.getDesc(), "用户ID:" + ret.get("userId")));
|
|
@@ -816,12 +822,17 @@ public class UserController extends ControllerSupport {
|
|
|
public void updatePass(@RequestParam String password) {
|
|
|
User accessUser = getAccessUser();
|
|
|
Long userId = accessUser.getUserId();
|
|
|
- if (password.length() < 6) {
|
|
|
- throw new StatusException("150411", "密码长度至少6位");
|
|
|
+
|
|
|
+ // if (password.length() < 6) {
|
|
|
+ // throw new StatusException("150411", "密码长度至少6位");
|
|
|
+ // }
|
|
|
+ if(!BaseUtil.checkPassword(password)){
|
|
|
+ throw new StatusException("密码至少包含大写字母、小写字母、数字、特殊符号中的三种,且长度限制在6-10位!");
|
|
|
}
|
|
|
+
|
|
|
UserEntity user = GlobalHelper.getEntity(userRepo, userId, UserEntity.class);
|
|
|
- String realPassword = StringEscapeUtils.unescapeJavaScript(password);
|
|
|
- byte[] bytes = SHA256.encode(user.getLoginName() + realPassword);
|
|
|
+ // String realPassword = StringEscapeUtils.unescapeJavaScript(password);
|
|
|
+ byte[] bytes = SHA256.encode(user.getLoginName() + password);
|
|
|
String encodePassword = ByteUtil.toHexAscii(bytes);
|
|
|
int ret = userRepo.updatePasswordById(userId, encodePassword);
|
|
|
if (ret == 0) {
|