diff --git a/backend/src/middleware/helpers/email/templateBuilder.js b/backend/src/middleware/helpers/email/templateBuilder.js index 3073c257c..5f615f01d 100644 --- a/backend/src/middleware/helpers/email/templateBuilder.js +++ b/backend/src/middleware/helpers/email/templateBuilder.js @@ -19,7 +19,7 @@ const defaultParams = { } const englishHint = 'English version below!' -export const signupTemplate = ({ email, nonce, inviteCode = null }) => { +export const signupTemplate = ({ email, variables: { 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) @@ -84,7 +84,7 @@ export const wrongAccountTemplate = ({ email }) => { } } -export const notificationTemplate = ({ email, notification }) => { +export const notificationTemplate = ({ email, variables: { notification } }) => { const actionUrl = new URL('/notifications', CONFIG.CLIENT_URI) const settingsUrl = new URL('/settings/notifications', CONFIG.CLIENT_URI) const renderParams = { ...defaultParams, name: notification.to.name, settingsUrl, actionUrl } diff --git a/backend/src/middleware/helpers/email/templates/de/notification.html b/backend/src/middleware/helpers/email/templates/de/notification.html index d935424be..a54943310 100644 --- a/backend/src/middleware/helpers/email/templates/de/notification.html +++ b/backend/src/middleware/helpers/email/templates/de/notification.html @@ -25,8 +25,7 @@

Hallo {{ name }},

-

Du hast mindestens eine Benachrichtigung erhalten. Klick auf diesen Button, - um sie anzusehen:

+

Du hast mindestens eine Benachrichtigung erhalten. Klick auf diesen Button, um sie anzusehen:

diff --git a/backend/src/middleware/login/loginMiddleware.js b/backend/src/middleware/login/loginMiddleware.js index b7fe0239a..f2f1cde7f 100644 --- a/backend/src/middleware/login/loginMiddleware.js +++ b/backend/src/middleware/login/loginMiddleware.js @@ -11,9 +11,9 @@ const sendSignupMail = async (resolve, root, args, context, resolveInfo) => { const response = await resolve(root, args, context, resolveInfo) const { email, nonce } = response if (inviteCode) { - await sendMail(signupTemplate({ email, nonce, inviteCode })) + await sendMail(signupTemplate({ email, variables: { nonce, inviteCode } })) } else { - await sendMail(signupTemplate({ email, nonce })) + await sendMail(signupTemplate({ email, variables: { nonce } })) } delete response.nonce return response diff --git a/backend/src/middleware/notifications/notificationsMiddleware.js b/backend/src/middleware/notifications/notificationsMiddleware.js index 2bc53ab7c..5419771ea 100644 --- a/backend/src/middleware/notifications/notificationsMiddleware.js +++ b/backend/src/middleware/notifications/notificationsMiddleware.js @@ -41,7 +41,6 @@ const publishNotifications = async (context, promises) => { notifications.forEach((notificationAdded, index) => { pubsub.publish(NOTIFICATION_ADDED, { notificationAdded }) if (notificationAdded.to.sendNotificationEmails) { - // Wolle await sendMail( notificationTemplate({ email: notificationsEmailAddresses[index].email, diff --git a/backend/src/middleware/slugifyMiddleware.spec.js b/backend/src/middleware/slugifyMiddleware.spec.js index 9f1969c0c..7c6f18ab1 100644 --- a/backend/src/middleware/slugifyMiddleware.spec.js +++ b/backend/src/middleware/slugifyMiddleware.spec.js @@ -195,7 +195,7 @@ describe('slugifyMiddleware', () => { variables = { ...variables, name: 'I am a user', - nonce: '123456', + nonce: '12345', password: 'yo', email: '123@example.org', termsAndConditionsAgreedVersion: '0.0.1', @@ -206,7 +206,7 @@ describe('slugifyMiddleware', () => { beforeEach(async () => { await Factory.build('emailAddress', { email: '123@example.org', - nonce: '123456', + nonce: '12345', verifiedAt: null, }) }) diff --git a/backend/src/schema/resolvers/passwordReset.spec.js b/backend/src/schema/resolvers/passwordReset.spec.js index 0a66a7a64..3e55ee6fd 100644 --- a/backend/src/schema/resolvers/passwordReset.spec.js +++ b/backend/src/schema/resolvers/passwordReset.spec.js @@ -118,7 +118,7 @@ describe('passwordReset', () => { describe('resetPassword', () => { const setup = async (options = {}) => { - const { email = 'user@example.org', issuedAt = new Date(), nonce = 'abcdef' } = options + const { email = 'user@example.org', issuedAt = new Date(), nonce = 'abcde' } = options await createPasswordReset({ driver, email, issuedAt, nonce }) } @@ -148,7 +148,7 @@ describe('resetPassword', () => { describe('invalid email', () => { it('resolves to false', async () => { await setup() - variables = { ...variables, email: 'non-existent@example.org', nonce: 'abcdef' } + variables = { ...variables, email: 'non-existent@example.org', nonce: 'abcde' } await expect(mutate({ mutation, variables })).resolves.toMatchObject({ data: { resetPassword: false }, }) @@ -177,7 +177,7 @@ describe('resetPassword', () => { beforeEach(() => { variables = { ...variables, - nonce: 'abcdef', + nonce: 'abcde', } }) diff --git a/backend/src/schema/resolvers/registration.spec.js b/backend/src/schema/resolvers/registration.spec.js index 753639118..573af1d35 100644 --- a/backend/src/schema/resolvers/registration.spec.js +++ b/backend/src/schema/resolvers/registration.spec.js @@ -179,7 +179,7 @@ describe('SignupVerification', () => { beforeEach(async () => { variables = { ...variables, - nonce: '123456', + nonce: '12345', name: 'John Doe', password: '123', email: 'john@example.org', @@ -207,7 +207,7 @@ describe('SignupVerification', () => { describe('sending a valid nonce', () => { beforeEach(() => { - variables = { ...variables, nonce: '123456' } + variables = { ...variables, nonce: '12345' } }) it('rejects', async () => { @@ -222,7 +222,7 @@ describe('SignupVerification', () => { beforeEach(async () => { const args = { email: 'john@example.org', - nonce: '123456', + nonce: '12345', } await neode.model('EmailAddress').create(args) }) diff --git a/webapp/components/PasswordReset/ChangePassword.spec.js b/webapp/components/PasswordReset/ChangePassword.spec.js index d6f451604..cef110798 100644 --- a/webapp/components/PasswordReset/ChangePassword.spec.js +++ b/webapp/components/PasswordReset/ChangePassword.spec.js @@ -40,7 +40,7 @@ describe('ChangePassword ', () => { describe('given email and nonce', () => { beforeEach(() => { propsData.email = 'mail@example.org' - propsData.nonce = '123456' + propsData.nonce = '12345' }) describe('submitting new password', () => { @@ -57,7 +57,7 @@ describe('ChangePassword ', () => { it('delivers new password to backend', () => { const expected = expect.objectContaining({ - variables: { nonce: '123456', email: 'mail@example.org', password: 'supersecret' }, + variables: { nonce: '12345', email: 'mail@example.org', password: 'supersecret' }, }) expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) })