Browse Source

两个登录 账号加密

master
jianjun 3 years ago
parent
commit
9958f5939a
  1. 4
      epmet-auth/src/main/java/com/epmet/controller/GovWebController.java
  2. 11
      epmet-auth/src/main/java/com/epmet/controller/LoginController.java

4
epmet-auth/src/main/java/com/epmet/controller/GovWebController.java

@ -48,6 +48,10 @@ public class GovWebController {
String newPassword = RSASignature.decryptByPrivateKey(formDTO.getPassword(), privateKey); String newPassword = RSASignature.decryptByPrivateKey(formDTO.getPassword(), privateKey);
formDTO.setPassword(newPassword); formDTO.setPassword(newPassword);
} }
if (formDTO.getPhone().length() > 50) {
String phone = RSASignature.decryptByPrivateKey(formDTO.getPhone(), privateKey);
formDTO.setPhone(phone);
}
} catch (Exception e) { } catch (Exception e) {
log.error("method exception", e); log.error("method exception", e);

11
epmet-auth/src/main/java/com/epmet/controller/LoginController.java

@ -1,6 +1,7 @@
package com.epmet.controller; package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.ErrorCode; import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.RSASignature; import com.epmet.commons.tools.utils.RSASignature;
@ -98,7 +99,15 @@ public class LoginController {
//效验数据 //效验数据
ValidatorUtils.validateEntity(formDTO); ValidatorUtils.validateEntity(formDTO);
//解密密码 //解密密码
if (formDTO.getPassword().length() > 50) { if (formDTO.getPhone().length() > NumConstant.FIFTY) {
String phone = RSASignature.decryptByPrivateKey(formDTO.getPhone(), privateKey);
formDTO.setPhone(phone);
}
if (formDTO.getMobile().length() > NumConstant.FIFTY) {
String phone = RSASignature.decryptByPrivateKey(formDTO.getMobile(), privateKey);
formDTO.setMobile(phone);
}
if (formDTO.getPassword().length() > NumConstant.FIFTY) {
String confirmNewPassWord = RSASignature.decryptByPrivateKey(formDTO.getPassword(), privateKey); String confirmNewPassWord = RSASignature.decryptByPrivateKey(formDTO.getPassword(), privateKey);
formDTO.setPassword(confirmNewPassWord); formDTO.setPassword(confirmNewPassWord);
} }

Loading…
Cancel
Save