mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Refactor 'sendResetPasswordEmail' email to HTML and translatable
This commit is contained in:
parent
44f2e6b06a
commit
a652654be7
@ -11,7 +11,7 @@ html(lang=locale)
|
||||
br
|
||||
a(href=activationLink) #{activationLink}
|
||||
br
|
||||
span= t('emails.accountActivation.orCopyLink')
|
||||
span= t('emails.general.orCopyLink')
|
||||
p= t('emails.accountActivation.duration', { hours: timeDurationObject.hours, minutes: timeDurationObject.minutes })
|
||||
br
|
||||
a(href=resendLink) #{resendLink}
|
||||
|
||||
20
backend/src/emails/resetPassword/html.pug
Normal file
20
backend/src/emails/resetPassword/html.pug
Normal file
@ -0,0 +1,20 @@
|
||||
doctype html
|
||||
html(lang=locale)
|
||||
head
|
||||
title= t('emails.resetPassword.subject')
|
||||
body
|
||||
h1(style='margin-bottom: 24px;')= t('emails.resetPassword.subject')
|
||||
#container.col
|
||||
p(style='margin-bottom: 24px;')= t('emails.general.helloName', { firstName, lastName })
|
||||
p= t('emails.resetPassword.youOrSomeoneResetPassword')
|
||||
p= t('emails.resetPassword.pleaseClickLink')
|
||||
br
|
||||
a(href=resetLink) #{resetLink}
|
||||
br
|
||||
span= t('emails.general.orCopyLink')
|
||||
p= t('emails.resetPassword.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/resetPassword/subject.pug
Normal file
1
backend/src/emails/resetPassword/subject.pug
Normal file
@ -0,0 +1 @@
|
||||
= t('emails.resetPassword.subject')
|
||||
@ -124,3 +124,25 @@ export const sendContributionRejectedEmail = (data: {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const sendResetPasswordEmail = (data: {
|
||||
firstName: string
|
||||
lastName: string
|
||||
email: string
|
||||
language: string
|
||||
resetLink: string
|
||||
timeDurationObject: Record<string, unknown>
|
||||
}): Promise<Record<string, unknown> | null> => {
|
||||
return sendEmailTranslated({
|
||||
receiver: { to: `${data.firstName} ${data.lastName} <${data.email}>` },
|
||||
template: 'resetPassword',
|
||||
locals: {
|
||||
firstName: data.firstName,
|
||||
lastName: data.lastName,
|
||||
locale: data.language,
|
||||
resetLink: data.resetLink,
|
||||
timeDurationObject: data.timeDurationObject,
|
||||
resendLink: CONFIG.EMAIL_LINK_FORGOTPASSWORD,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@ -18,10 +18,10 @@ import UnsecureLoginArgs from '@arg/UnsecureLoginArgs'
|
||||
import UpdateUserInfosArgs from '@arg/UpdateUserInfosArgs'
|
||||
import { klicktippNewsletterStateMiddleware } from '@/middleware/klicktippMiddleware'
|
||||
import { OptInType } from '@enum/OptInType'
|
||||
import { sendResetPasswordEmail as sendResetPasswordEmailMailer } from '@/mailer/sendResetPasswordEmail'
|
||||
import {
|
||||
sendAccountActivationEmail,
|
||||
sendAccountMultiRegistrationEmail,
|
||||
sendResetPasswordEmail,
|
||||
} from '@/emails/sendEmailVariants'
|
||||
import { klicktippSignIn } from '@/apis/KlicktippController'
|
||||
import { RIGHTS } from '@/auth/RIGHTS'
|
||||
@ -574,12 +574,13 @@ export class UserResolver {
|
||||
// optInCode = await checkOptInCode(optInCode, user, OptInType.EMAIL_OPT_IN_RESET_PASSWORD)
|
||||
logger.info(`optInCode for ${email}=${dbUserContact}`)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const emailSent = await sendResetPasswordEmailMailer({
|
||||
link: activationLink(dbUserContact.emailVerificationCode),
|
||||
const emailSent = await sendResetPasswordEmail({
|
||||
firstName: user.firstName,
|
||||
lastName: user.lastName,
|
||||
email,
|
||||
duration: printTimeDuration(CONFIG.EMAIL_CODE_VALID_TIME),
|
||||
language: user.language,
|
||||
resetLink: activationLink(dbUserContact.emailVerificationCode),
|
||||
timeDurationObject: getTimeDurationObject(CONFIG.EMAIL_CODE_VALID_TIME),
|
||||
})
|
||||
|
||||
/* uncomment this, when you need the activation link on the console */
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
"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"
|
||||
},
|
||||
"accountMultiRegistration": {
|
||||
@ -30,10 +29,17 @@
|
||||
"subject": "Gradido: Dein Gemeinwohl-Beitrag wurde abgelehnt",
|
||||
"toSeeContributionsAndMessages": "Um deine Gemeinwohl-Beiträge und dazugehörige Nachrichten zu sehen, gehe in deinem Gradido-Konto ins Menü „Gemeinschaft“ auf den Tab „Meine Beiträge zum Gemeinwohl“!"
|
||||
},
|
||||
"resetPassword": {
|
||||
"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:",
|
||||
"pleaseClickLink": "Wenn du es warst, klicke bitte auf den Link:",
|
||||
"subject": "Gradido: Passwort zurücksetzen",
|
||||
"youOrSomeoneResetPassword": "du, oder jemand anderes, hast für dieses Konto ein Zurücksetzen des Passworts angefordert."
|
||||
},
|
||||
"general": {
|
||||
"decimalSeparator": ",",
|
||||
"helloName": "Hallo {firstName} {lastName},",
|
||||
"linkToYourAccount": "Link zu deinem Konto:",
|
||||
"orCopyLink": "oder kopiere den obigen Link in dein Browserfenster.",
|
||||
"pleaseDoNotReply": "Bitte antworte nicht auf diese E-Mail!",
|
||||
"sincerelyYours": "Liebe Grüße",
|
||||
"yourGradidoTeam": "dein Gradido-Team"
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
"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"
|
||||
},
|
||||
"accountMultiRegistration": {
|
||||
@ -21,19 +20,26 @@
|
||||
"subject": "Gradido: Try To Register Again With Your Email"
|
||||
},
|
||||
"contributionConfirmed": {
|
||||
"commonGoodContributionConfirmed": "your public good contribution “{contributionMemo}” has just been confirmed by {senderFirstName} {senderLastName} and credited to your Gradido account.",
|
||||
"commonGoodContributionConfirmed": "Your public good contribution “{contributionMemo}” has just been confirmed by {senderFirstName} {senderLastName} and credited to your Gradido account.",
|
||||
"contributionAmount": "Amount: {contributionAmount} GDD",
|
||||
"subject": "Gradido: Your common good contribution was confirmed"
|
||||
},
|
||||
"contributionRejected": {
|
||||
"commonGoodContributionRejected": "your public good contribution “{contributionMemo}” was rejected by {senderFirstName} {senderLastName}.",
|
||||
"commonGoodContributionRejected": "Your public good contribution “{contributionMemo}” was rejected by {senderFirstName} {senderLastName}.",
|
||||
"subject": "Gradido: Your common good contribution was rejected",
|
||||
"toSeeContributionsAndMessages": "To see your common good contributions and related messages, go to the “Community” menu in your Gradido account and click on the “My contributions to the common good” tab!"
|
||||
},
|
||||
"resetPassword": {
|
||||
"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:",
|
||||
"pleaseClickLink": "If it was you, please click on the link:",
|
||||
"subject": "Gradido: Reset password",
|
||||
"youOrSomeoneResetPassword": "You, or someone else, requested a password reset for this account."
|
||||
},
|
||||
"general": {
|
||||
"decimalSeparator": ".",
|
||||
"helloName": "Hello {firstName} {lastName}",
|
||||
"linkToYourAccount": "Link to your account:",
|
||||
"orCopyLink": "or copy the link above into your browser window.",
|
||||
"pleaseDoNotReply": "Please do not reply to this email!",
|
||||
"sincerelyYours": "Kind regards,",
|
||||
"yourGradidoTeam": "your Gradido team"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user