fix: wrong links in verification and forgot password emails if serverURL not set (#3010)
This commit is contained in:
@@ -85,9 +85,11 @@ async function forgotPassword(incomingArgs: Arguments): Promise<string | null> {
|
||||
const userJSON = user.toJSON({ virtuals: true });
|
||||
|
||||
if (!disableEmail) {
|
||||
const serverURL = (config.serverURL !== null && config.serverURL !== '') ? config.serverURL : `${req.protocol}://${req.get('host')}`;
|
||||
|
||||
let html = `${t('authentication:youAreReceivingResetPassword')}
|
||||
<a href="${config.serverURL}${config.routes.admin}/reset/${token}">
|
||||
${config.serverURL}${config.routes.admin}/reset/${token}
|
||||
<a href="${serverURL}${config.routes.admin}/reset/${token}">
|
||||
${serverURL}${config.routes.admin}/reset/${token}
|
||||
</a>
|
||||
${t('authentication:youDidNotRequestPassword')}`;
|
||||
|
||||
|
||||
@@ -32,7 +32,9 @@ async function sendVerificationEmail(args: Args): Promise<void> {
|
||||
} = args;
|
||||
|
||||
if (!disableEmail) {
|
||||
const verificationURL = `${config.serverURL}${config.routes.admin}/${collectionConfig.slug}/verify/${token}`;
|
||||
const serverURL = (config.serverURL !== null && config.serverURL !== '') ? config.serverURL : `${req.protocol}://${req.get('host')}`;
|
||||
|
||||
const verificationURL = `${serverURL}${config.routes.admin}/${collectionConfig.slug}/verify/${token}`;
|
||||
|
||||
let html = `${req.t('authentication:newAccountCreated', { interpolation: { escapeValue: false }, serverURL: config.serverURL, verificationURL })}`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user