mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 15:39:24 +08:00
fix(auth): update email configuration to use notification channel and add system settings to reset password email
This commit is contained in:
parent
6a005bcb41
commit
1aff1be8cd
@ -28,12 +28,6 @@ export const useSystemSettingsVariable = () => {
|
||||
label: t('System title'),
|
||||
isLeaf: true,
|
||||
},
|
||||
{
|
||||
key: 'logo',
|
||||
value: 'logo',
|
||||
label: t('Logo (URL)'),
|
||||
isLeaf: true,
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
|
@ -48,7 +48,7 @@ describe('auth:lostPassword', () => {
|
||||
public: {
|
||||
enableResetPassword: true,
|
||||
},
|
||||
emailChannel: 'email',
|
||||
notificationChannel: 'email',
|
||||
emailSubject: 'Reset your password',
|
||||
emailContentType: 'html',
|
||||
emailContentHTML: 'Click the link to reset your password: {{$resetLink}}',
|
||||
@ -212,7 +212,7 @@ describe('auth:lostPassword', () => {
|
||||
public: {
|
||||
enableResetPassword: true,
|
||||
},
|
||||
emailChannel: 'email',
|
||||
notificationChannel: 'email',
|
||||
emailSubject: 'Reset password for {{$user.username}}',
|
||||
emailContentType: 'html',
|
||||
emailContentHTML: 'Click the link to reset your password: {{$user.username}}',
|
||||
|
@ -193,6 +193,8 @@ export class BasicAuth extends BaseAuth {
|
||||
// 构建重置密码链接
|
||||
const resetLink = `${baseURL}/reset-password?resetToken=${resetToken}`;
|
||||
|
||||
const systemSettings = await ctx.db.getRepository('systemSettings')?.findOne() || {};
|
||||
|
||||
// 通过通知管理插件发送邮件
|
||||
const notificationManager = ctx.app.getPlugin('notification-manager');
|
||||
if (notificationManager) {
|
||||
@ -204,6 +206,8 @@ export class BasicAuth extends BaseAuth {
|
||||
$resetLink: resetLink,
|
||||
$nDate: getDateVars(),
|
||||
$env: ctx.app.environment.getVariables(),
|
||||
$resetLinkExpiration: resetTokenExpiresIn,
|
||||
$systemSettings: systemSettings,
|
||||
});
|
||||
|
||||
const parsedContent = parsedValue(emailContentType === 'html' ? emailContentHTML : emailContentText, {
|
||||
@ -211,6 +215,8 @@ export class BasicAuth extends BaseAuth {
|
||||
$resetLink: resetLink,
|
||||
$nDate: getDateVars(),
|
||||
$env: ctx.app.environment.getVariables(),
|
||||
$resetLinkExpiration: resetTokenExpiresIn,
|
||||
$systemSettings: systemSettings,
|
||||
});
|
||||
|
||||
const content = emailContentType === 'html' ? { html: parsedContent } : { text: parsedContent };
|
||||
|
Loading…
x
Reference in New Issue
Block a user