diff --git a/backend/.env.dist b/backend/.env.dist index 033417025..b0a08753c 100644 --- a/backend/.env.dist +++ b/backend/.env.dist @@ -1,4 +1,4 @@ -CONFIG_VERSION=v4.2022-04-05 +CONFIG_VERSION=v5.2022-04-12 # Server PORT=4000 @@ -43,6 +43,7 @@ EMAIL_SMTP_PORT=587 EMAIL_LINK_VERIFICATION=http://localhost/checkEmail/{optin}{code} EMAIL_LINK_SETPASSWORD=http://localhost/reset-password/{optin} EMAIL_LINK_FORGOTPASSWORD=http://localhost/forgot-password +EMAIL_LINK_OVERVIEW=http://localhost/overview EMAIL_CODE_VALID_TIME=1440 EMAIL_CODE_REQUEST_TIME=10 diff --git a/backend/.env.template b/backend/.env.template index 011e413df..5da108f53 100644 --- a/backend/.env.template +++ b/backend/.env.template @@ -41,6 +41,7 @@ EMAIL_SMTP_URL=$EMAIL_SMTP_URL EMAIL_SMTP_PORT=587 EMAIL_LINK_VERIFICATION=$EMAIL_LINK_VERIFICATION EMAIL_LINK_SETPASSWORD=$EMAIL_LINK_SETPASSWORD +EMAIL_LINK_OVERVIEW=$EMAIL_LINK_OVERVIEW EMAIL_CODE_VALID_TIME=$EMAIL_CODE_VALID_TIME EMAIL_CODE_REQUEST_TIME=$EMAIL_CODE_REQUEST_TIME diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index fe9b40ccc..91f450369 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -14,7 +14,7 @@ const constants = { DECAY_START_TIME: new Date('2021-05-13 17:46:31'), // GMT+0 CONFIG_VERSION: { DEFAULT: 'DEFAULT', - EXPECTED: 'v4.2022-04-05', + EXPECTED: 'v5.2022-04-12', CURRENT: '', }, } @@ -72,6 +72,7 @@ const email = { process.env.EMAIL_LINK_SETPASSWORD || 'http://localhost/reset-password/{optin}', EMAIL_LINK_FORGOTPASSWORD: process.env.EMAIL_LINK_FORGOTPASSWORD || 'http://localhost/forgot-password', + EMAIL_LINK_OVERVIEW: process.env.EMAIL_LINK_OVERVIEW || 'http://localhost/overview', // time in minutes a optin code is valid EMAIL_CODE_VALID_TIME: process.env.EMAIL_CODE_VALID_TIME ? parseInt(process.env.EMAIL_CODE_VALID_TIME) || 1440 diff --git a/backend/src/graphql/resolver/TransactionResolver.ts b/backend/src/graphql/resolver/TransactionResolver.ts index 540ab8fcf..69e1899d9 100644 --- a/backend/src/graphql/resolver/TransactionResolver.ts +++ b/backend/src/graphql/resolver/TransactionResolver.ts @@ -1,6 +1,8 @@ /* eslint-disable new-cap */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ +import CONFIG from '@/config' + import { Context, getUser } from '@/server/context' import { Resolver, Query, Args, Authorized, Ctx, Mutation } from 'type-graphql' import { getCustomRepository, getConnection } from '@dbTools/typeorm' @@ -134,6 +136,7 @@ export const executeTransaction = async ( senderEmail: sender.email, amount, memo, + overviewURL: CONFIG.EMAIL_LINK_OVERVIEW, }) return true diff --git a/backend/src/mailer/sendTransactionReceivedEmail.test.ts b/backend/src/mailer/sendTransactionReceivedEmail.test.ts index 1ebc9dae3..75631cc7a 100644 --- a/backend/src/mailer/sendTransactionReceivedEmail.test.ts +++ b/backend/src/mailer/sendTransactionReceivedEmail.test.ts @@ -20,6 +20,7 @@ describe('sendTransactionReceivedEmail', () => { senderEmail: 'bibi@bloxberg.de', amount: new Decimal(42.0), memo: 'Vielen herzlichen Dank für den neuen Hexenbesen!', + overviewURL: 'http://localhost/overview', }) }) @@ -32,7 +33,8 @@ describe('sendTransactionReceivedEmail', () => { expect.stringContaining('42,00 GDD') && expect.stringContaining('Bibi Bloxberg') && expect.stringContaining('(bibi@bloxberg.de)') && - expect.stringContaining('Vielen herzlichen Dank für den neuen Hexenbesen!'), + expect.stringContaining('Vielen herzlichen Dank für den neuen Hexenbesen!') && + expect.stringContaining('http://localhost/overview'), }) }) }) diff --git a/backend/src/mailer/sendTransactionReceivedEmail.ts b/backend/src/mailer/sendTransactionReceivedEmail.ts index 934783449..537c13d85 100644 --- a/backend/src/mailer/sendTransactionReceivedEmail.ts +++ b/backend/src/mailer/sendTransactionReceivedEmail.ts @@ -11,6 +11,7 @@ export const sendTransactionReceivedEmail = (data: { senderEmail: string amount: Decimal memo: string + overviewURL: string }): Promise => { return sendEMail({ to: `${data.recipientFirstName} ${data.recipientLastName} <${data.email}>`, diff --git a/backend/src/mailer/text/transactionReceived.ts b/backend/src/mailer/text/transactionReceived.ts index 520ee43bf..07d03ad45 100644 --- a/backend/src/mailer/text/transactionReceived.ts +++ b/backend/src/mailer/text/transactionReceived.ts @@ -12,6 +12,7 @@ export const transactionReceived = { senderEmail: string amount: Decimal memo: string + overviewURL: string }): string => `Hallo ${data.recipientFirstName} ${data.recipientLastName} @@ -25,6 +26,9 @@ ${data.memo} Bitte antworte nicht auf diese E-Mail! Mit freundlichen Grüßen, -dein Gradido-Team`, +dein Gradido-Team + + +Link zu deinem Konto: ${data.overviewURL}`, }, } diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 8254fd9c2..4c6e956af 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -18,7 +18,7 @@ WEBHOOK_GITHUB_SECRET=secret WEBHOOK_GITHUB_BRANCH=master # backend -BACKEND_CONFIG_VERSION=v4.2022-04-05 +BACKEND_CONFIG_VERSION=v5.2022-04-12 JWT_EXPIRES_IN=30m GDT_API_URL=https://gdt.gradido.net @@ -44,6 +44,7 @@ EMAIL_SMTP_URL=smtp.lustig.de EMAIL_LINK_VERIFICATION=https://stage1.gradido.net/checkEmail/{optin}{code} EMAIL_LINK_SETPASSWORD=https://stage1.gradido.net/reset-password/{optin} EMAIL_LINK_FORGOTPASSWORD=https://stage1.gradido.net/forgot-password +EMAIL_LINK_OVERVIEW=https://stage1.gradido.net/overview EMAIL_CODE_VALID_TIME=1440 EMAIL_CODE_REQUEST_TIME=10