mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Translate and HTML'lize email 'sendAccountActivation'
This commit is contained in:
parent
e9c4de5373
commit
369752783c
@ -1,11 +1,11 @@
|
||||
doctype html
|
||||
html(lang="en")
|
||||
html(lang=locale)
|
||||
head
|
||||
title= t('emails.accountMultiRegistration.subject')
|
||||
body
|
||||
h1(style='margin-bottom: 24px;')= t('emails.accountMultiRegistration.subject')
|
||||
#container.col
|
||||
p(style='margin-bottom: 24px;')= t('emails.accountMultiRegistration.helloName', { firstName, lastName })
|
||||
p(style='margin-bottom: 24px;')= t('emails.general.helloName', { firstName, lastName })
|
||||
p= t('emails.accountMultiRegistration.emailReused')
|
||||
br
|
||||
span= t('emails.accountMultiRegistration.emailExists')
|
||||
@ -17,6 +17,6 @@ html(lang="en")
|
||||
p= t('emails.accountMultiRegistration.ifYouAreNotTheOne')
|
||||
br
|
||||
a(href='https://gradido.net/de/contact/') https://gradido.net/de/contact/
|
||||
p(style='margin-top: 24px;')= t('emails.accountMultiRegistration.sincerelyYours')
|
||||
p(style='margin-top: 24px;')= t('emails.general.sincerelyYours')
|
||||
br
|
||||
span= t('emails.accountMultiRegistration.yourGradidoTeam')
|
||||
span= t('emails.general.yourGradidoTeam')
|
||||
|
||||
20
backend/src/emails/sendAccountActivation/html.pug
Normal file
20
backend/src/emails/sendAccountActivation/html.pug
Normal file
@ -0,0 +1,20 @@
|
||||
doctype html
|
||||
html(lang=locale)
|
||||
head
|
||||
title= t('emails.sendAccountActivation.subject')
|
||||
body
|
||||
h1(style='margin-bottom: 24px;')= t('emails.sendAccountActivation.subject')
|
||||
#container.col
|
||||
p(style='margin-bottom: 24px;')= t('emails.general.helloName', { firstName, lastName })
|
||||
p= t('emails.sendAccountActivation.emailRegistered')
|
||||
p= t('emails.sendAccountActivation.pleaseClickLink')
|
||||
br
|
||||
a(href=activationLink) #{activationLink}
|
||||
br
|
||||
span= t('emails.sendAccountActivation.orCopyLink')
|
||||
p= t('emails.sendAccountActivation.duration', { hours: timeDurationObject.hours, minutes: timeDurationObject.minutes })
|
||||
br
|
||||
a(href=resendLink) #{resendLink}
|
||||
p(style='margin-top: 24px;')= t('emails.general.sincerelyYours')
|
||||
br
|
||||
span= t('emails.general.yourGradidoTeam')
|
||||
1
backend/src/emails/sendAccountActivation/subject.pug
Normal file
1
backend/src/emails/sendAccountActivation/subject.pug
Normal file
@ -0,0 +1 @@
|
||||
= t('emails.sendAccountActivation.subject')
|
||||
@ -12,7 +12,7 @@ export const sendEmailTranslated = async (params: {
|
||||
cc?: string
|
||||
}
|
||||
template: string
|
||||
locals: Record<string, string>
|
||||
locals: Record<string, unknown>
|
||||
}): Promise<Record<string, unknown> | null> => {
|
||||
let resultSend: Record<string, unknown> | null = null
|
||||
|
||||
@ -50,7 +50,7 @@ export const sendEmailTranslated = async (params: {
|
||||
},
|
||||
})
|
||||
|
||||
i18n.setLocale(params.locals.locale) // for email
|
||||
i18n.setLocale(params.locals.locale as string) // for email
|
||||
|
||||
// TESTING: see 'README.md'
|
||||
const email = new Email({
|
||||
|
||||
@ -11,9 +11,31 @@ export const sendAccountMultiRegistrationEmail = (data: {
|
||||
receiver: { to: `${data.firstName} ${data.lastName} <${data.email}>` },
|
||||
template: 'accountMultiRegistration',
|
||||
locals: {
|
||||
locale: data.language,
|
||||
firstName: data.firstName,
|
||||
lastName: data.lastName,
|
||||
locale: data.language,
|
||||
resendLink: CONFIG.EMAIL_LINK_FORGOTPASSWORD,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const sendAccountActivationEmail = (data: {
|
||||
firstName: string
|
||||
lastName: string
|
||||
email: string
|
||||
language: string
|
||||
activationLink: string
|
||||
timeDurationObject: Record<string, unknown>
|
||||
}): Promise<Record<string, unknown> | null> => {
|
||||
return sendEmailTranslated({
|
||||
receiver: { to: `${data.firstName} ${data.lastName} <${data.email}>` },
|
||||
template: 'sendAccountActivation',
|
||||
locals: {
|
||||
firstName: data.firstName,
|
||||
lastName: data.lastName,
|
||||
locale: data.language,
|
||||
activationLink: data.activationLink,
|
||||
timeDurationObject: data.timeDurationObject,
|
||||
resendLink: CONFIG.EMAIL_LINK_FORGOTPASSWORD,
|
||||
},
|
||||
})
|
||||
|
||||
@ -18,8 +18,10 @@ import UpdateUserInfosArgs from '@arg/UpdateUserInfosArgs'
|
||||
import { klicktippNewsletterStateMiddleware } from '@/middleware/klicktippMiddleware'
|
||||
import { OptInType } from '@enum/OptInType'
|
||||
import { sendResetPasswordEmail as sendResetPasswordEmailMailer } from '@/mailer/sendResetPasswordEmail'
|
||||
import { sendAccountActivationEmail } from '@/mailer/sendAccountActivationEmail'
|
||||
import { sendAccountMultiRegistrationEmail } from '@/emails/sendEmailVariants'
|
||||
import {
|
||||
sendAccountActivationEmail,
|
||||
sendAccountMultiRegistrationEmail,
|
||||
} from '@/emails/sendEmailVariants'
|
||||
import { klicktippSignIn } from '@/apis/KlicktippController'
|
||||
import { RIGHTS } from '@/auth/RIGHTS'
|
||||
import { hasElopageBuys } from '@/util/hasElopageBuys'
|
||||
@ -543,11 +545,12 @@ export class UserResolver {
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const emailSent = await sendAccountActivationEmail({
|
||||
link: activationLink,
|
||||
firstName,
|
||||
lastName,
|
||||
email,
|
||||
duration: printTimeDuration(CONFIG.EMAIL_CODE_VALID_TIME),
|
||||
language,
|
||||
activationLink,
|
||||
timeDurationObject: getTimeDurationObject(CONFIG.EMAIL_CODE_VALID_TIME),
|
||||
})
|
||||
logger.info(`sendAccountActivationEmail of ${firstName}.${lastName} to ${email}`)
|
||||
eventSendConfirmEmail.userId = dbUser.id
|
||||
|
||||
@ -3,13 +3,22 @@
|
||||
"accountMultiRegistration": {
|
||||
"emailExists": "Es existiert jedoch zu deiner E-Mail-Adresse schon ein Konto.",
|
||||
"emailReused": "Deine E-Mail-Adresse wurde soeben erneut benutzt, um bei Gradido ein Konto zu registrieren.",
|
||||
"helloName": "Hallo {firstName} {lastName}",
|
||||
"ifYouAreNotTheOne": "Wenn du nicht derjenige bist, der sich versucht hat erneut zu registrieren, wende dich bitte an unseren support:",
|
||||
"onForgottenPasswordClickLink": "Klicke bitte auf den folgenden Link, falls du dein Passwort vergessen haben solltest:",
|
||||
"onForgottenPasswordCopyLink": "oder kopiere den obigen Link in dein Browserfenster.",
|
||||
"subject": "Gradido: Erneuter Registrierungsversuch mit deiner E-Mail"
|
||||
},
|
||||
"general": {
|
||||
"helloName": "Hallo {firstName} {lastName}",
|
||||
"sincerelyYours": "Mit freundlichen Grüßen,",
|
||||
"subject": "Gradido: Erneuter Registrierungsversuch mit deiner E-Mail",
|
||||
"yourGradidoTeam": "dein Gradido-Team"
|
||||
},
|
||||
"sendAccountActivation": {
|
||||
"duration": "Der Link hat eine Gültigkeit von {hours} Stunden und {minutes} Minuten. Sollte die Gültigkeit des Links bereits abgelaufen sein, kannst du dir hier einen neuen Link schicken lassen, in dem du deine E-Mail-Adresse eingibst:",
|
||||
"emailRegistered": "Deine E-Mail-Adresse wurde soeben bei Gradido registriert.",
|
||||
"pleaseClickLink": "Klicke bitte auf diesen Link, um die Registrierung abzuschließen und dein Gradido-Konto zu aktivieren:",
|
||||
"orCopyLink": "oder kopiere den obigen Link in dein Browserfenster.",
|
||||
"subject": "Gradido: E-Mail Überprüfung"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,15 +1,24 @@
|
||||
{
|
||||
"emails": {
|
||||
"accountMultiRegistration": {
|
||||
"emails": {
|
||||
"accountMultiRegistration": {
|
||||
"emailExists": "However, an account already exists for your email address.",
|
||||
"emailReused": "Your email address has just been used again to register an account with Gradido.",
|
||||
"helloName": "Hello {firstName} {lastName}",
|
||||
"ifYouAreNotTheOne": "If you are not the one who tried to register again, please contact our support:",
|
||||
"onForgottenPasswordClickLink": "Please click on the following link if you have forgotten your password:",
|
||||
"onForgottenPasswordCopyLink": "or copy the link above into your browser window.",
|
||||
"subject": "Gradido: Try To Register Again With Your Email"
|
||||
},
|
||||
"general": {
|
||||
"helloName": "Hello {firstName} {lastName}",
|
||||
"sincerelyYours": "Sincerely yours,",
|
||||
"subject": "Gradido: Try To Register Again With Your Email",
|
||||
"yourGradidoTeam": "your Gradido team"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sendAccountActivation": {
|
||||
"duration": "The link has a validity of {hours} hours and {minutes} minutes. If the validity of the link has already expired, you can have a new link sent to you here by entering your email address:",
|
||||
"emailRegistered": "Your email address has just been registered with Gradido.",
|
||||
"pleaseClickLink": "Please click on this link to complete the registration and activate your Gradido account:",
|
||||
"orCopyLink": "or copy the link above into your browser window.",
|
||||
"subject": "Gradido: Email Verification"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user