mirror of https://github.com/halo-dev/halo
feat: log reset password code if didn't config smtp.
parent
6aa31fb2d2
commit
a0d4c7493f
|
@ -211,12 +211,6 @@ public class AdminServiceImpl implements AdminService {
|
||||||
throw new ServiceException("已经获取过验证码,不能重复获取");
|
throw new ServiceException("已经获取过验证码,不能重复获取");
|
||||||
});
|
});
|
||||||
|
|
||||||
Boolean emailEnabled = optionService.getByPropertyOrDefault(EmailProperties.ENABLED, Boolean.class, false);
|
|
||||||
|
|
||||||
if (!emailEnabled) {
|
|
||||||
throw new ServiceException("未启用 SMTP 服务");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!userService.verifyUser(param.getUsername(), param.getEmail())) {
|
if (!userService.verifyUser(param.getUsername(), param.getEmail())) {
|
||||||
throw new ServiceException("用户名或者邮箱验证错误");
|
throw new ServiceException("用户名或者邮箱验证错误");
|
||||||
}
|
}
|
||||||
|
@ -226,12 +220,18 @@ public class AdminServiceImpl implements AdminService {
|
||||||
|
|
||||||
log.info("Get reset password code:{}", code);
|
log.info("Get reset password code:{}", code);
|
||||||
|
|
||||||
|
// Cache code.
|
||||||
|
cacheStore.putAny("code", code, 5, TimeUnit.MINUTES);
|
||||||
|
|
||||||
|
Boolean emailEnabled = optionService.getByPropertyOrDefault(EmailProperties.ENABLED, Boolean.class, false);
|
||||||
|
|
||||||
|
if (!emailEnabled) {
|
||||||
|
throw new ServiceException("未启用 SMTP 服务,无法发送邮件,但是你可以通过系统日志找到验证码");
|
||||||
|
}
|
||||||
|
|
||||||
// Send email to administrator.
|
// Send email to administrator.
|
||||||
String content = "您正在进行密码重置操作,如不是本人操作,请尽快做好相应措施。密码重置验证码如下(五分钟有效):\n" + code;
|
String content = "您正在进行密码重置操作,如不是本人操作,请尽快做好相应措施。密码重置验证码如下(五分钟有效):\n" + code;
|
||||||
mailService.sendMail(param.getEmail(), "找回密码验证码", content);
|
mailService.sendMail(param.getEmail(), "找回密码验证码", content);
|
||||||
|
|
||||||
// Cache code.
|
|
||||||
cacheStore.putAny("code", code, 5, TimeUnit.MINUTES);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class MarkdownUtils {
|
||||||
.set(TocExtension.LEVELS, 255)
|
.set(TocExtension.LEVELS, 255)
|
||||||
.set(TablesExtension.WITH_CAPTION, false)
|
.set(TablesExtension.WITH_CAPTION, false)
|
||||||
.set(TablesExtension.COLUMN_SPANS, false)
|
.set(TablesExtension.COLUMN_SPANS, false)
|
||||||
.set(TablesExtension.MIN_SEPARATOR_DASHES,1)
|
.set(TablesExtension.MIN_SEPARATOR_DASHES, 1)
|
||||||
.set(TablesExtension.MIN_HEADER_ROWS, 1)
|
.set(TablesExtension.MIN_HEADER_ROWS, 1)
|
||||||
.set(TablesExtension.MAX_HEADER_ROWS, 1)
|
.set(TablesExtension.MAX_HEADER_ROWS, 1)
|
||||||
.set(TablesExtension.APPEND_MISSING_COLUMNS, true)
|
.set(TablesExtension.APPEND_MISSING_COLUMNS, true)
|
||||||
|
|
Loading…
Reference in New Issue