mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 23:49:27 +08:00
feat: lostPassword
This commit is contained in:
parent
cee8e0d099
commit
b397f4656b
@ -190,17 +190,23 @@ export class BasicAuth extends BaseAuth {
|
||||
// 通过通知管理插件发送邮件
|
||||
const notificationManager = ctx.app.getPlugin('notification-manager');
|
||||
if (notificationManager) {
|
||||
const emailer = notificationManager.getChannel(emailChannel);
|
||||
const emailer = notificationManager.channelTypes.get(emailChannel);
|
||||
if (emailer) {
|
||||
await emailer.send({
|
||||
to: email,
|
||||
subject,
|
||||
content: parsedValue(content, {
|
||||
$user: user,
|
||||
$resetLink: `${ctx.request.protocol}://${ctx.request.host}/reset-password?token=${resetToken}`,
|
||||
$date: getDateVars(),
|
||||
$env: ctx.app.environment.getVariables(),
|
||||
}),
|
||||
const parsedContent = parsedValue(emailContent, {
|
||||
$user: user,
|
||||
$resetLink: `${process.env.API_BAST_URL}/reset-password?token=${resetToken}`,
|
||||
$date: getDateVars(),
|
||||
$env: ctx.app.environment.getVariables(),
|
||||
});
|
||||
const content = emailContentType === 'html' ? { html: parsedContent } : { text: parsedContent };
|
||||
await notificationManager.send({
|
||||
channelName: emailChannel,
|
||||
message: {
|
||||
to: [email],
|
||||
subject: emailSubject,
|
||||
contentType: emailContentType,
|
||||
...content,
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ctx.throw(400, ctx.t('Email channel not found', { ns: namespace }));
|
||||
|
Loading…
x
Reference in New Issue
Block a user