Browse Source

feat:修改邮件信息保存接口

mozuwen 5 months ago
parent
commit
1ea1099144

+ 8 - 3
service-manage/src/main/java/com/simuwang/manage/service/impl/EmailConfigServiceImpl.java

@@ -124,7 +124,8 @@ public class EmailConfigServiceImpl implements EmailConfigService {
         ResultVo vo = new ResultVo(ResultCode.CONNECT_SUCCESS);
         MailboxInfoDTO mailboxInfoDTO = new MailboxInfoDTO();
         mailboxInfoDTO.setAccount(mailboxInfoVO.getEmail());
-        mailboxInfoDTO.setPassword(getPassword(mailboxInfoVO.getPassword()));
+        // mailboxInfoDTO.setPassword(getPassword(mailboxInfoVO.getPassword()));
+        mailboxInfoDTO.setPassword(mailboxInfoVO.getPassword());
         mailboxInfoDTO.setPort(mailboxInfoVO.getPort());
         mailboxInfoDTO.setHost(mailboxInfoVO.getServer());
         mailboxInfoDTO.setProtocol(mailboxInfoVO.getProtocol());
@@ -251,7 +252,8 @@ public class EmailConfigServiceImpl implements EmailConfigService {
         mailboxInfoDO.setServer(mailboxInfoVO.getServer());
         mailboxInfoDO.setPort(mailboxInfoVO.getPort());
         mailboxInfoDO.setDescription(mailboxInfoVO.getDescription());
-        mailboxInfoDO.setPassword(mailboxInfoVO.getPassword());
+        // mailboxInfoDO.setPassword(mailboxInfoVO.getPassword());
+        mailboxInfoDO.setPassword(encryptPassword(mailboxInfoVO.getPassword()));
         mailboxInfoDO.setType(mailboxInfoVO.getType());
         mailboxInfoDO.setProtocol(mailboxInfoVO.getProtocol());
         mailboxInfoDO.setOpenStatus(mailboxInfoVO.getOpenStatus());
@@ -261,5 +263,8 @@ public class EmailConfigServiceImpl implements EmailConfigService {
         return mailboxInfoDO;
     }
 
-
+    private String encryptPassword (String password){
+        String publicKey = this.properties.getSecurityRsa().getPublicKey();
+        return new RSA(null, publicKey).encryptBase64(password, KeyType.PublicKey);
+    }
 }