-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added public url variable for emails #2967
Changes from 6 commits
702abd3
caa51ad
15d311c
f3317f0
bfa919c
adc0f32
a8c9356
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,11 +11,10 @@ import { LoggerProxy as Logger } from 'n8n-workflow'; | |
|
||
import { Db, InternalHooksManager, ResponseHelper } from '../..'; | ||
import { N8nApp } from '../Interfaces'; | ||
import { validatePassword } from '../UserManagementHelper'; | ||
import { getInstanceBaseUrl, validatePassword } from '../UserManagementHelper'; | ||
import * as UserManagementMailer from '../email'; | ||
import type { PasswordResetRequest } from '../../requests'; | ||
import { issueCookie } from '../auth/jwt'; | ||
import { getBaseUrl } from '../../GenericHelpers'; | ||
import config = require('../../../config'); | ||
|
||
export function passwordResetNamespace(this: N8nApp): void { | ||
|
@@ -73,8 +72,8 @@ export function passwordResetNamespace(this: N8nApp): void { | |
|
||
await Db.collections.User!.update(id, { resetPasswordToken, resetPasswordTokenExpiration }); | ||
|
||
const baseUrl = getBaseUrl(); | ||
const url = new URL('/change-password', baseUrl); | ||
const baseUrl = getInstanceBaseUrl(); | ||
const url = new URL(`${baseUrl}change-password`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. from my gut feeling i would have written the route with a slash prefix feels weird to omit it |
||
url.searchParams.append('userId', id); | ||
url.searchParams.append('token', resetPasswordToken); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -176,7 +176,7 @@ export function usersNamespace(this: N8nApp): void { | |
const emailingResults = await Promise.all( | ||
usersPendingSetup.map(async ([email, id]) => { | ||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions | ||
const inviteAcceptUrl = `${baseUrl}/signup?inviterId=${req.user.id}&inviteeId=${id}`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ref decision on trailing slash |
||
const inviteAcceptUrl = `${baseUrl}signup?inviterId=${req.user.id}&inviteeId=${id}`; | ||
const result = await mailer?.invite({ | ||
email, | ||
inviteAcceptUrl, | ||
|
@@ -512,7 +512,7 @@ export function usersNamespace(this: N8nApp): void { | |
} | ||
|
||
const baseUrl = getInstanceBaseUrl(); | ||
const inviteAcceptUrl = `${baseUrl}/signup?inviterId=${req.user.id}&inviteeId=${reinvitee.id}`; | ||
const inviteAcceptUrl = `${baseUrl}signup?inviterId=${req.user.id}&inviteeId=${reinvitee.id}`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ref decision on trailing slash |
||
|
||
let mailer: UserManagementMailer.UserManagementMailer | undefined; | ||
try { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to me getting a string with a trailing slash feels weird