From b3292e991a0f74cffa32b22937ce5afd20d48867 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 5 May 2021 18:13:59 +0100 Subject: [PATCH] Making the code a query string parameter for invite/reset urls. --- packages/worker/src/api/routes/tests/auth.spec.js | 2 +- packages/worker/src/api/routes/tests/users.spec.js | 2 +- packages/worker/src/utilities/templates.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/worker/src/api/routes/tests/auth.spec.js b/packages/worker/src/api/routes/tests/auth.spec.js index ea7ab829a3..df90210433 100644 --- a/packages/worker/src/api/routes/tests/auth.spec.js +++ b/packages/worker/src/api/routes/tests/auth.spec.js @@ -30,7 +30,7 @@ describe("/api/admin/auth", () => { expect(sendMailMock).toHaveBeenCalled() const emailCall = sendMailMock.mock.calls[0][0] // after this URL there should be a code - const parts = emailCall.html.split("http://localhost:10000/reset/") + const parts = emailCall.html.split("http://localhost:10000/reset?code=") code = parts[1].split("\"")[0] expect(code).toBeDefined() }) diff --git a/packages/worker/src/api/routes/tests/users.spec.js b/packages/worker/src/api/routes/tests/users.spec.js index 135d29f0f5..0a4812ea09 100644 --- a/packages/worker/src/api/routes/tests/users.spec.js +++ b/packages/worker/src/api/routes/tests/users.spec.js @@ -30,7 +30,7 @@ describe("/api/admin/users", () => { expect(sendMailMock).toHaveBeenCalled() const emailCall = sendMailMock.mock.calls[0][0] // after this URL there should be a code - const parts = emailCall.html.split("http://localhost:10000/invite/") + const parts = emailCall.html.split("http://localhost:10000/invite?code=") code = parts[1].split("\"")[0] expect(code).toBeDefined() }) diff --git a/packages/worker/src/utilities/templates.js b/packages/worker/src/utilities/templates.js index f3fe881b21..e5d94859f2 100644 --- a/packages/worker/src/utilities/templates.js +++ b/packages/worker/src/utilities/templates.js @@ -35,13 +35,13 @@ exports.getSettingsTemplateContext = async (purpose, code = null) => { case EmailTemplatePurpose.PASSWORD_RECOVERY: context[TemplateBindings.RESET_CODE] = code context[TemplateBindings.RESET_URL] = checkSlashesInUrl( - `${URL}/reset/${code}` + `${URL}/reset?code=${code}` ) break case EmailTemplatePurpose.INVITATION: context[TemplateBindings.INVITE_CODE] = code context[TemplateBindings.REGISTRATION_URL] = checkSlashesInUrl( - `${URL}/invite/${code}` + `${URL}/invite?code=${code}` ) break }