提交 b06baf81 编写于 作者: rushui.chen's avatar rushui.chen

20190911 修改密码的处理方式

上级 052fc02f
流水线 #14353 已失败 于阶段
in 0 second
...@@ -13,7 +13,6 @@ import com.pica.cloud.account.account.server.service.LoginService; ...@@ -13,7 +13,6 @@ import com.pica.cloud.account.account.server.service.LoginService;
import com.pica.cloud.account.account.server.service.TokenService; import com.pica.cloud.account.account.server.service.TokenService;
import com.pica.cloud.account.account.server.util.AccountUtils; import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.account.account.server.util.CryptoUtil; import com.pica.cloud.account.account.server.util.CryptoUtil;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResponse; import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.redis.ICacheClient; import com.pica.cloud.foundation.redis.ICacheClient;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
......
...@@ -79,7 +79,7 @@ public class LoginServiceImpl implements LoginService { ...@@ -79,7 +79,7 @@ public class LoginServiceImpl implements LoginService {
if (accountInfoEntity != null) { if (accountInfoEntity != null) {
String oldPwd = accountInfoEntity.getPassword(); String oldPwd = accountInfoEntity.getPassword();
String password = request.getPassword(); String password = request.getPassword();
if (password.equals(EncryptCreateUtil.dencrypt(oldPwd))) { if (password.equals(oldPwd)) {
//登陆成功,返回新的token //登陆成功,返回新的token
//通过账户id查询用户id //通过账户id查询用户id
Date currentTime = new Date(); Date currentTime = new Date();
......
...@@ -28,16 +28,16 @@ public class PasswordServiceImpl implements PasswordService { ...@@ -28,16 +28,16 @@ public class PasswordServiceImpl implements PasswordService {
@Override @Override
public void modifyPassword(Integer acctId, String oldPwd, String pwd) { public void modifyPassword(Integer acctId, String oldPwd, String pwd) {
AccountInfoEntity entity = accountInfoDetailMapper.selectByPrimaryKey(acctId); AccountInfoEntity entity = accountInfoDetailMapper.selectByPrimaryKey(acctId);
if (entity.getPassword().equals(EncryptCreateUtil.encrypt(oldPwd))) { if (entity.getPassword().equals(oldPwd)) {
AccountInfoEntity accountInfoEntity = new AccountInfoEntity(); AccountInfoEntity accountInfoEntity = new AccountInfoEntity();
accountInfoEntity.setId(acctId); accountInfoEntity.setId(acctId);
accountInfoEntity.setModifiedId(acctId); accountInfoEntity.setModifiedId(acctId);
accountInfoEntity.setModifiedTime(new Date()); accountInfoEntity.setModifiedTime(new Date());
accountInfoEntity.setPassword(EncryptCreateUtil.encrypt(pwd)); accountInfoEntity.setPassword(pwd);
accountInfoDetailMapper.updatePasswordByPrimaryKey(accountInfoEntity); accountInfoDetailMapper.updatePasswordByPrimaryKey(accountInfoEntity);
//密码修改日志 //密码修改日志
LogPWDModifyEntity logPWDModifyEntity = AccountLogEntityUtils.getLogPWDModifyEntity(acctId, entity.getMobilePhone(), LogPWDModifyEntity logPWDModifyEntity = AccountLogEntityUtils.getLogPWDModifyEntity(acctId, entity.getMobilePhone(),
EncryptCreateUtil.encrypt(oldPwd), EncryptCreateUtil.encrypt(pwd), AccountTypeEnum.LOG_TYPE_PASSWORD.getCode()); oldPwd, pwd, AccountTypeEnum.LOG_TYPE_PASSWORD.getCode());
picaLogUtils.info(logPWDModifyEntity); picaLogUtils.info(logPWDModifyEntity);
} else { } else {
throw new AccountException(AccountExceptionEnum.PICA_PASSWORD_ERROR); throw new AccountException(AccountExceptionEnum.PICA_PASSWORD_ERROR);
...@@ -53,12 +53,11 @@ public class PasswordServiceImpl implements PasswordService { ...@@ -53,12 +53,11 @@ public class PasswordServiceImpl implements PasswordService {
accountInfoEntity.setId(accId); accountInfoEntity.setId(accId);
accountInfoEntity.setModifiedId(accId); accountInfoEntity.setModifiedId(accId);
accountInfoEntity.setModifiedTime(new Date()); accountInfoEntity.setModifiedTime(new Date());
accountInfoEntity.setPassword(EncryptCreateUtil.encrypt(request.getPassword())); accountInfoEntity.setPassword(request.getPassword());
accountInfoDetailMapper.updatePasswordByPrimaryKey(accountInfoEntity); accountInfoDetailMapper.updatePasswordByPrimaryKey(accountInfoEntity);
//密码修改日志 //密码修改日志
LogPWDModifyEntity logPWDModifyEntity = AccountLogEntityUtils.getLogPWDModifyEntity(accId, entity.getMobilePhone(), LogPWDModifyEntity logPWDModifyEntity = AccountLogEntityUtils.getLogPWDModifyEntity(accId, entity.getMobilePhone(),
"", EncryptCreateUtil.encrypt(request.getPassword()), AccountTypeEnum.LOG_TYPE_PASSWORD.getCode()); "", request.getPassword(), AccountTypeEnum.LOG_TYPE_PASSWORD.getCode());
picaLogUtils.info(logPWDModifyEntity); picaLogUtils.info(logPWDModifyEntity);
} else { } else {
//未注册,请先注册 //未注册,请先注册
......
...@@ -65,7 +65,7 @@ public class RegisterServiceImpl implements RegisterService { ...@@ -65,7 +65,7 @@ public class RegisterServiceImpl implements RegisterService {
AccountInfoEntity accountInfo = new AccountInfoEntity(); AccountInfoEntity accountInfo = new AccountInfoEntity();
accountInfo.setMobilePhone(EncryptCreateUtil.encrypt(baseRequest.getMobile())); accountInfo.setMobilePhone(EncryptCreateUtil.encrypt(baseRequest.getMobile()));
if (StringUtils.isNotEmpty(baseRequest.getPassword())) { if (StringUtils.isNotEmpty(baseRequest.getPassword())) {
accountInfo.setPassword(EncryptCreateUtil.encrypt(baseRequest.getPassword())); accountInfo.setPassword(baseRequest.getPassword());
} else { } else {
accountInfo.setPassword(""); accountInfo.setPassword("");
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册