|
@@ -98,7 +98,7 @@ public class EmailConfigServiceImpl implements EmailConfigService {
|
|
|
//请求参数
|
|
|
MailboxInfoDTO paramDTO = new MailboxInfoDTO();
|
|
|
paramDTO.setAccount(infoDO.getEmail());
|
|
|
- paramDTO.setPassword(infoDO.getPassword());
|
|
|
+ paramDTO.setPassword(getPassword(infoDO.getPassword()));
|
|
|
paramDTO.setPort(infoDO.getPort());
|
|
|
paramDTO.setHost(infoDO.getServer());
|
|
|
paramDTO.setProtocol(infoDO.getProtocol());
|
|
@@ -108,19 +108,24 @@ public class EmailConfigServiceImpl implements EmailConfigService {
|
|
|
logger.error(e.getMessage(),e);
|
|
|
}
|
|
|
}
|
|
|
- @Override
|
|
|
- public ResultVo connectTest(MailboxInfoVO mailboxInfoVO) {
|
|
|
- ResultVo vo = new ResultVo(ResultCode.CONNECT_SUCCESS);
|
|
|
- MailboxInfoDTO mailboxInfoDTO = new MailboxInfoDTO();
|
|
|
- mailboxInfoDTO.setAccount(mailboxInfoVO.getEmail());
|
|
|
+
|
|
|
+ private String getPassword(String password){
|
|
|
try{
|
|
|
String publicKey = this.properties.getSecurityRsa().getPublicKey();
|
|
|
String privateKey = this.properties.getSecurityRsa().getPrivateKey();
|
|
|
- String password = new RSA(privateKey, publicKey).decryptStr(mailboxInfoVO.getPassword(), KeyType.PrivateKey);
|
|
|
- mailboxInfoDTO.setPassword(password);
|
|
|
+ password = new RSA(privateKey, publicKey).decryptStr(password, KeyType.PrivateKey);
|
|
|
}catch (Exception e){
|
|
|
logger.error(e.getMessage(),e);
|
|
|
}
|
|
|
+ return password;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultVo connectTest(MailboxInfoVO mailboxInfoVO) {
|
|
|
+ ResultVo vo = new ResultVo(ResultCode.CONNECT_SUCCESS);
|
|
|
+ MailboxInfoDTO mailboxInfoDTO = new MailboxInfoDTO();
|
|
|
+ mailboxInfoDTO.setAccount(mailboxInfoVO.getEmail());
|
|
|
+ mailboxInfoDTO.setPassword(getPassword(mailboxInfoVO.getPassword()));
|
|
|
mailboxInfoDTO.setPort(mailboxInfoVO.getPort());
|
|
|
mailboxInfoDTO.setHost(mailboxInfoVO.getServer());
|
|
|
mailboxInfoDTO.setProtocol(mailboxInfoVO.getProtocol());
|