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'),
|
label: t('System title'),
|
||||||
isLeaf: true,
|
isLeaf: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'logo',
|
|
||||||
value: 'logo',
|
|
||||||
label: t('Logo (URL)'),
|
|
||||||
isLeaf: true,
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ describe('auth:lostPassword', () => {
|
|||||||
public: {
|
public: {
|
||||||
enableResetPassword: true,
|
enableResetPassword: true,
|
||||||
},
|
},
|
||||||
emailChannel: 'email',
|
notificationChannel: 'email',
|
||||||
emailSubject: 'Reset your password',
|
emailSubject: 'Reset your password',
|
||||||
emailContentType: 'html',
|
emailContentType: 'html',
|
||||||
emailContentHTML: 'Click the link to reset your password: {{$resetLink}}',
|
emailContentHTML: 'Click the link to reset your password: {{$resetLink}}',
|
||||||
@ -212,7 +212,7 @@ describe('auth:lostPassword', () => {
|
|||||||
public: {
|
public: {
|
||||||
enableResetPassword: true,
|
enableResetPassword: true,
|
||||||
},
|
},
|
||||||
emailChannel: 'email',
|
notificationChannel: 'email',
|
||||||
emailSubject: 'Reset password for {{$user.username}}',
|
emailSubject: 'Reset password for {{$user.username}}',
|
||||||
emailContentType: 'html',
|
emailContentType: 'html',
|
||||||
emailContentHTML: 'Click the link to reset your password: {{$user.username}}',
|
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 resetLink = `${baseURL}/reset-password?resetToken=${resetToken}`;
|
||||||
|
|
||||||
|
const systemSettings = await ctx.db.getRepository('systemSettings')?.findOne() || {};
|
||||||
|
|
||||||
// 通过通知管理插件发送邮件
|
// 通过通知管理插件发送邮件
|
||||||
const notificationManager = ctx.app.getPlugin('notification-manager');
|
const notificationManager = ctx.app.getPlugin('notification-manager');
|
||||||
if (notificationManager) {
|
if (notificationManager) {
|
||||||
@ -204,6 +206,8 @@ export class BasicAuth extends BaseAuth {
|
|||||||
$resetLink: resetLink,
|
$resetLink: resetLink,
|
||||||
$nDate: getDateVars(),
|
$nDate: getDateVars(),
|
||||||
$env: ctx.app.environment.getVariables(),
|
$env: ctx.app.environment.getVariables(),
|
||||||
|
$resetLinkExpiration: resetTokenExpiresIn,
|
||||||
|
$systemSettings: systemSettings,
|
||||||
});
|
});
|
||||||
|
|
||||||
const parsedContent = parsedValue(emailContentType === 'html' ? emailContentHTML : emailContentText, {
|
const parsedContent = parsedValue(emailContentType === 'html' ? emailContentHTML : emailContentText, {
|
||||||
@ -211,6 +215,8 @@ export class BasicAuth extends BaseAuth {
|
|||||||
$resetLink: resetLink,
|
$resetLink: resetLink,
|
||||||
$nDate: getDateVars(),
|
$nDate: getDateVars(),
|
||||||
$env: ctx.app.environment.getVariables(),
|
$env: ctx.app.environment.getVariables(),
|
||||||
|
$resetLinkExpiration: resetTokenExpiresIn,
|
||||||
|
$systemSettings: systemSettings,
|
||||||
});
|
});
|
||||||
|
|
||||||
const content = emailContentType === 'html' ? { html: parsedContent } : { text: parsedContent };
|
const content = emailContentType === 'html' ? { html: parsedContent } : { text: parsedContent };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user