mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
fix enail confirmation link when an invite-code is given
This commit is contained in:
parent
b92a7a10dd
commit
27f0de9464
@ -43,9 +43,14 @@ if (!hasEmailConfig) {
|
||||
}
|
||||
|
||||
const sendSignupMail = async (resolve, root, args, context, resolveInfo) => {
|
||||
const { inviteCode } = args
|
||||
const response = await resolve(root, args, context, resolveInfo)
|
||||
const { email, nonce } = response
|
||||
await sendMail(signupTemplate({ email, nonce }))
|
||||
if (inviteCode) {
|
||||
await sendMail(signupTemplate({ email, nonce, inviteCode }))
|
||||
} else {
|
||||
await sendMail(signupTemplate({ email, nonce }))
|
||||
}
|
||||
delete response.nonce
|
||||
return response
|
||||
}
|
||||
|
||||
@ -13,14 +13,19 @@ const defaultParams = {
|
||||
welcomeImageUrl,
|
||||
}
|
||||
|
||||
export const signupTemplate = ({ email, nonce }) => {
|
||||
export const signupTemplate = ({ email, nonce, inviteCode = null }) => {
|
||||
const subject = `Willkommen, Bienvenue, Welcome to ${CONFIG.APPLICATION_NAME}!`
|
||||
// dev format example: http://localhost:3000/registration?method=invite-mail&email=wolle.huss%40pjannto.com&nonce=64853
|
||||
const actionUrl = new URL('/registration', CONFIG.CLIENT_URI)
|
||||
actionUrl.searchParams.set('method', 'invite-mail')
|
||||
actionUrl.searchParams.set('email', email)
|
||||
actionUrl.searchParams.set('nonce', nonce)
|
||||
|
||||
if (inviteCode) {
|
||||
actionUrl.searchParams.set('inviteCode', inviteCode)
|
||||
actionUrl.searchParams.set('method', 'invite-code')
|
||||
} else {
|
||||
actionUrl.searchParams.set('method', 'invite-mail')
|
||||
}
|
||||
|
||||
return {
|
||||
from,
|
||||
to: email,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user