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

This commit is contained in:
CaptainB 2022-02-17 14:22:36 +08:00 committed by 刘瑞斌
parent c7bb191680
commit d6a494c891
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);
@ -530,7 +527,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();
@ -1290,6 +1287,7 @@ public class UserService {
/**
* 根据userId 获取 user 所属工作空间和所属工作项目
*
* @param userId
*/
public Map<Object, Object> getWSAndProjectByUserId(String userId) {
@ -1302,9 +1300,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;
}