|
@@ -93,12 +93,13 @@ public class SysUserServiceImpl implements SysUserService {
|
|
|
UserAddCmd cmd = (UserAddCmd) command;
|
|
|
SysUserDO entity = cmd.toEntity();
|
|
|
String originalPwd = cmd.getPassword();
|
|
|
+ // 密码在前端已加密
|
|
|
if (StrUtil.isBlank(originalPwd)) {
|
|
|
originalPwd = this.properties.getDefaultPwd();
|
|
|
+ String publicKey = this.properties.getSecurityRsa().getPublicKey();
|
|
|
+ String password = new RSA(null, publicKey).encryptBase64(originalPwd, KeyType.PublicKey);
|
|
|
+ entity.setPassword(password);
|
|
|
}
|
|
|
- String publicKey = this.properties.getSecurityRsa().getPublicKey();
|
|
|
- String password = new RSA(null, publicKey).encryptBase64(originalPwd, KeyType.PublicKey);
|
|
|
- entity.setPassword(password);
|
|
|
this.mapper.insert(entity);
|
|
|
}
|
|
|
|
|
@@ -106,10 +107,7 @@ public class SysUserServiceImpl implements SysUserService {
|
|
|
public <C extends BaseEditCmd<SysUserDO>> void update(C command) {
|
|
|
UserEditCmd cmd = (UserEditCmd) command;
|
|
|
SysUserDO entity = cmd.toEntity();
|
|
|
- String originalPwd = cmd.getPassword();
|
|
|
- String publicKey = this.properties.getSecurityRsa().getPublicKey();
|
|
|
- String password = new RSA(null, publicKey).encryptBase64(originalPwd, KeyType.PublicKey);
|
|
|
- entity.setPassword(password);
|
|
|
+ // 密码在前端已加密
|
|
|
this.mapper.updateById(entity);
|
|
|
}
|
|
|
|