mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-21 16:28:09 +08:00
ForgotPassword
This commit is contained in:
@@ -124,6 +124,32 @@ public class OtpAuthnService {
|
||||
}
|
||||
return otpAuthn;
|
||||
}
|
||||
|
||||
public AbstractOtpAuthn getMailOtpAuthn(String instId) {
|
||||
AbstractOtpAuthn otpAuthn = otpAuthnStore.getIfPresent(instId);
|
||||
if(otpAuthn == null) {
|
||||
EmailSenders emailSender =
|
||||
emailSendersService.findOne("where instid = ? ", new Object[]{instId}, new int[]{Types.VARCHAR});
|
||||
|
||||
String credentials = PasswordReciprocal.getInstance().decoder(emailSender.getCredentials());
|
||||
EmailConfig emailConfig =
|
||||
new EmailConfig(
|
||||
emailSender.getAccount(),
|
||||
credentials,
|
||||
emailSender.getSmtpHost(),
|
||||
emailSender.getPort(),
|
||||
ConstsBoolean.isTrue(emailSender.getSslSwitch()),
|
||||
emailSender.getSender());
|
||||
MailOtpAuthn mailOtpAuthn = new MailOtpAuthn(emailConfig);
|
||||
mailOtpAuthn.setInterval(60 * 5);//5 minute
|
||||
if(redisOptTokenStore != null) {
|
||||
mailOtpAuthn.setOptTokenStore(redisOptTokenStore);
|
||||
}
|
||||
otpAuthn = mailOtpAuthn;
|
||||
}
|
||||
otpAuthnStore.put(instId, otpAuthn);
|
||||
return otpAuthn;
|
||||
}
|
||||
|
||||
public void setRedisOptTokenStore(RedisOtpTokenStore redisOptTokenStore) {
|
||||
this.redisOptTokenStore = redisOptTokenStore;
|
||||
|
||||
Reference in New Issue
Block a user