|
@@ -133,16 +133,7 @@ public class MdeEnterpriseAuthServiceImpl implements MdeEnterpriseAuthService {
|
|
|
createLoginLog(null, email, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS);
|
|
|
throw exception(MDE_USER_EMAIL_NOT_REGISTERED);
|
|
|
}
|
|
|
- if (userBindService.checkNeedUpdatePassword(user.getEnterpriseId(), user.getUserId())) {
|
|
|
- // 效验有没有更改过密码
|
|
|
- // 没有则发送邮箱
|
|
|
- MailSendSingleToUserReqDTO reqDTO = new MailSendSingleToUserReqDTO();
|
|
|
- reqDTO.setMail(email);
|
|
|
- reqDTO.setTemplateCode(CommonConstants.EMAIL_ENTERPRISE_INIT_PASSWORD);
|
|
|
- reqDTO.setTemplateParams(MapUtil.builder("password", (Object) email).build());
|
|
|
- mailSendApi.sendSingleMailToMember(reqDTO).getCheckedData();
|
|
|
- throw exception(MDE_USER_EMAIL_INIT_PASSWORD);
|
|
|
- }
|
|
|
+
|
|
|
if (!userBindService.isPasswordMatch(password, user.getPassword())) {
|
|
|
createLoginLog(user.getId(), email, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS);
|
|
|
throw exception(MDE_AUTH_LOGIN_BAD_CREDENTIALS);
|
|
@@ -151,7 +142,19 @@ public class MdeEnterpriseAuthServiceImpl implements MdeEnterpriseAuthService {
|
|
|
// 校验是否禁用
|
|
|
if (ObjectUtil.notEqual(user.getStatus(), MendunerStatusEnum.ENABLE.getStatus())) {
|
|
|
createLoginLog(user.getId(), email, logTypeEnum, LoginResultEnum.USER_DISABLED);
|
|
|
- throw exception(MDE_AUTH_LOGIN_USER_DISABLED);
|
|
|
+ // 只有输错密码并且是首次才需要发邮箱告诉密码
|
|
|
+ if (userBindService.checkNeedUpdatePassword(user.getEnterpriseId(), user.getUserId())) {
|
|
|
+ // 效验有没有更改过密码
|
|
|
+ // 没有则发送邮箱
|
|
|
+ MailSendSingleToUserReqDTO reqDTO = new MailSendSingleToUserReqDTO();
|
|
|
+ reqDTO.setMail(email);
|
|
|
+ reqDTO.setTemplateCode(CommonConstants.EMAIL_ENTERPRISE_INIT_PASSWORD);
|
|
|
+ reqDTO.setTemplateParams(MapUtil.builder("password", (Object) email).build());
|
|
|
+ mailSendApi.sendSingleMailToMember(reqDTO).getCheckedData();
|
|
|
+ throw exception(MDE_USER_EMAIL_INIT_PASSWORD);
|
|
|
+ } else {
|
|
|
+ throw exception(MDE_AUTH_LOGIN_USER_DISABLED);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return user;
|