feat: 支持展示并复制重置后的密码
- 账号重置接口返回本次使用的默认强密码 - 管理端新增紧凑结果弹窗与复制反馈 - 补充服务测试和中英文文案
This commit is contained in:
@@ -32,7 +32,14 @@ public interface SysAccountService extends IService<SysAccount> {
|
||||
|
||||
SysAccount getByUsername(String userKey);
|
||||
|
||||
void resetPassword(BigInteger accountId, BigInteger operatorId);
|
||||
/**
|
||||
* 将账号密码重置为系统默认强密码。
|
||||
*
|
||||
* @param accountId 账号 ID
|
||||
* @param operatorId 操作人账号 ID
|
||||
* @return 本次重置后使用的明文密码
|
||||
*/
|
||||
String resetPassword(BigInteger accountId, BigInteger operatorId);
|
||||
|
||||
SysAccountBatchActionResultVo removeBatchWithResult(Collection<BigInteger> ids);
|
||||
|
||||
|
||||
@@ -231,21 +231,30 @@ public class SysAccountServiceImpl extends ServiceImpl<SysAccountMapper, SysAcco
|
||||
return getOne(w);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将账号密码重置为系统默认强密码。
|
||||
*
|
||||
* @param accountId 账号 ID
|
||||
* @param operatorId 操作人账号 ID
|
||||
* @return 本次重置后使用的明文密码
|
||||
*/
|
||||
@Override
|
||||
public void resetPassword(BigInteger accountId, BigInteger operatorId) {
|
||||
public String resetPassword(BigInteger accountId, BigInteger operatorId) {
|
||||
SysAccount record = getById(accountId);
|
||||
if (record == null) {
|
||||
throw new BusinessException("用户不存在");
|
||||
}
|
||||
validateResetPasswordAllowed(record);
|
||||
String plainPassword = accountSecurityProperties.getDefaultResetPassword();
|
||||
SysAccount update = new SysAccount();
|
||||
update.setId(accountId);
|
||||
update.setPassword(BCrypt.hashpw(accountSecurityProperties.getDefaultResetPassword()));
|
||||
update.setPassword(BCrypt.hashpw(plainPassword));
|
||||
update.setPasswordResetRequired(true);
|
||||
update.setModified(new Date());
|
||||
update.setModifiedBy(operatorId);
|
||||
updateById(update);
|
||||
StpUtil.kickout(accountId);
|
||||
return plainPassword;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user