|
@@ -31,7 +31,6 @@ import com.google.common.collect.Maps;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
-import org.apache.commons.lang.StringEscapeUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
@@ -537,7 +536,7 @@ public class UserController extends ControllerSupport {
|
|
trim(userForm, true);
|
|
trim(userForm, true);
|
|
userForm.setId(null);
|
|
userForm.setId(null);
|
|
|
|
|
|
- if(!BaseUtil.checkPassword(userForm.getPassword())){
|
|
|
|
|
|
+ if (!BaseUtil.checkPassword(userForm.getPassword())) {
|
|
throw new StatusException("密码至少包含大写字母、小写字母、数字、特殊符号中的三种,且长度限制在6-10位!");
|
|
throw new StatusException("密码至少包含大写字母、小写字母、数字、特殊符号中的三种,且长度限制在6-10位!");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -742,26 +741,36 @@ public class UserController extends ControllerSupport {
|
|
throw new StatusException("150410", "超级管理员账号不允许修改");
|
|
throw new StatusException("150410", "超级管理员账号不允许修改");
|
|
}
|
|
}
|
|
UserEntity user = GlobalHelper.getEntity(userRepo, userId, UserEntity.class);
|
|
UserEntity user = GlobalHelper.getEntity(userRepo, userId, UserEntity.class);
|
|
|
|
+ if (user == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ user.setPasswordWeak(true);
|
|
user.setPassword(ByteUtil.toHexAscii(SHA256.encode(user.getLoginName() + BasicConsts.DEFAULT_PASSWORD)));
|
|
user.setPassword(ByteUtil.toHexAscii(SHA256.encode(user.getLoginName() + BasicConsts.DEFAULT_PASSWORD)));
|
|
userRepo.save(user);
|
|
userRepo.save(user);
|
|
}
|
|
}
|
|
User accessUser = getAccessUser();
|
|
User accessUser = getAccessUser();
|
|
ReportsUtil.report(new AdminOperateReport(accessUser.getRootOrgId(), accessUser.getUserId(), AdminOperateType.TYPE8.getDesc(), "用户ID:" + id));
|
|
ReportsUtil.report(new AdminOperateReport(accessUser.getRootOrgId(), accessUser.getUserId(), AdminOperateType.TYPE8.getDesc(), "用户ID:" + id));
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@ApiOperation(value = "批量重置用户密码", notes = "重置密码")
|
|
@ApiOperation(value = "批量重置用户密码", notes = "重置密码")
|
|
@PostMapping("/resetPass")
|
|
@PostMapping("/resetPass")
|
|
@Transactional
|
|
@Transactional
|
|
public void resetPassBatch(@RequestParam Long[] ids) {
|
|
public void resetPassBatch(@RequestParam Long[] ids) {
|
|
- if(ids==null||ids.length==0) {
|
|
|
|
- throw new StatusException("用户ID不能为空");
|
|
|
|
- }
|
|
|
|
|
|
+ if (ids == null || ids.length == 0) {
|
|
|
|
+ throw new StatusException("用户ID不能为空");
|
|
|
|
+ }
|
|
for (Long userId : ids) {
|
|
for (Long userId : ids) {
|
|
if (isSuperAdmin(userId)) {
|
|
if (isSuperAdmin(userId)) {
|
|
throw new StatusException("150410", "超级管理员账号不允许修改");
|
|
throw new StatusException("150410", "超级管理员账号不允许修改");
|
|
}
|
|
}
|
|
UserEntity user = GlobalHelper.getEntity(userRepo, userId, UserEntity.class);
|
|
UserEntity user = GlobalHelper.getEntity(userRepo, userId, UserEntity.class);
|
|
|
|
+ if (user == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
user.setPassword(ByteUtil.toHexAscii(SHA256.encode(user.getLoginName() + BasicConsts.DEFAULT_PASSWORD)));
|
|
user.setPassword(ByteUtil.toHexAscii(SHA256.encode(user.getLoginName() + BasicConsts.DEFAULT_PASSWORD)));
|
|
|
|
+ user.setPasswordWeak(true);
|
|
userRepo.save(user);
|
|
userRepo.save(user);
|
|
}
|
|
}
|
|
User accessUser = getAccessUser();
|
|
User accessUser = getAccessUser();
|
|
@@ -780,6 +789,10 @@ public class UserController extends ControllerSupport {
|
|
throw new StatusException("150410", "超级管理员账号不允许修改");
|
|
throw new StatusException("150410", "超级管理员账号不允许修改");
|
|
}
|
|
}
|
|
UserEntity user = GlobalHelper.getEntity(userRepo, userId, UserEntity.class);
|
|
UserEntity user = GlobalHelper.getEntity(userRepo, userId, UserEntity.class);
|
|
|
|
+ if (user == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
user.setEnable(true);
|
|
user.setEnable(true);
|
|
userRepo.save(user);
|
|
userRepo.save(user);
|
|
ret.add(user.getId() + ":" + user.getName());
|
|
ret.add(user.getId() + ":" + user.getName());
|
|
@@ -801,6 +814,10 @@ public class UserController extends ControllerSupport {
|
|
throw new StatusException("150410", "超级管理员账号不允许修改");
|
|
throw new StatusException("150410", "超级管理员账号不允许修改");
|
|
}
|
|
}
|
|
UserEntity user = GlobalHelper.getEntity(userRepo, userId, UserEntity.class);
|
|
UserEntity user = GlobalHelper.getEntity(userRepo, userId, UserEntity.class);
|
|
|
|
+ if (user == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
user.setEnable(false);
|
|
user.setEnable(false);
|
|
userRepo.save(user);
|
|
userRepo.save(user);
|
|
ret.add(user.getId() + ":" + user.getName());
|
|
ret.add(user.getId() + ":" + user.getName());
|
|
@@ -826,7 +843,7 @@ public class UserController extends ControllerSupport {
|
|
// if (password.length() < 6) {
|
|
// if (password.length() < 6) {
|
|
// throw new StatusException("150411", "密码长度至少6位");
|
|
// throw new StatusException("150411", "密码长度至少6位");
|
|
// }
|
|
// }
|
|
- if(!BaseUtil.checkPassword(password)){
|
|
|
|
|
|
+ if (!BaseUtil.checkPassword(password)) {
|
|
throw new StatusException("密码至少包含大写字母、小写字母、数字、特殊符号中的三种,且长度限制在6-10位!");
|
|
throw new StatusException("密码至少包含大写字母、小写字母、数字、特殊符号中的三种,且长度限制在6-10位!");
|
|
}
|
|
}
|
|
|
|
|