refactor: 增加初始密码提示修改功能

This commit is contained in:
CaptainB 2022-02-17 14:22:36 +08:00 committed by fit2-zhao
parent 70fedc870a
commit d2c8c633a4
1 changed files with 4 additions and 7 deletions

View File

@ -33,12 +33,9 @@ import io.metersphere.excel.listener.EasyExcelListener;
import io.metersphere.excel.listener.UserDataListener;
import io.metersphere.excel.utils.EasyExcelExporter;
import io.metersphere.i18n.Translator;
import io.metersphere.log.service.OperatingLogService;
import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDTO;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.OperatingLogRequest;
import io.metersphere.log.vo.system.SystemReference;
import io.metersphere.notice.domain.UserDetail;
import io.metersphere.security.MsUserToken;
@ -98,7 +95,7 @@ public class UserService {
@Resource
private ExtWorkspaceMapper extWorkspaceMapper;
@Resource
private OperatingLogService operatingLogService;
private OperatingLogMapper operatingLogMapper;
public List<UserDetail> queryTypeByIds(List<String> userIds) {
return extUserMapper.queryTypeByIds(userIds);
@ -529,7 +526,7 @@ public class UserService {
String oldPassword = CodingUtil.md5(request.getPassword(), "utf-8");
String newPassword = request.getNewpassword();
String newPasswordMd5 = CodingUtil.md5(newPassword);
if(StringUtils.equals(oldPassword,newPasswordMd5)){
if (StringUtils.equals(oldPassword, newPasswordMd5)) {
return null;
}
UserExample userExample = new UserExample();
@ -1289,6 +1286,7 @@ public class UserService {
/**
* 根据userId 获取 user 所属工作空间和所属工作项目
*
* @param userId
*/
public Map<Object, Object> getWSAndProjectByUserId(String userId) {
@ -1301,9 +1299,8 @@ public class UserService {
}
public boolean checkWhetherChangePasswordOrNot(LoginRequest request) {
List<OperatingLogDTO> list = operatingLogService.list(new OperatingLogRequest());
// 首次登录需要提示
if (CollectionUtils.isEmpty(list)) {
if (operatingLogMapper.countByExample(new OperatingLogExample()) == 0) {
return true;
}