From 8253d0385c517771a8a9f1171d2f4303aa67fee9 Mon Sep 17 00:00:00 2001 From: nate stemen Date: Mon, 13 Jan 2020 09:59:58 -0700 Subject: [PATCH] Merge pull request #2462 from overleaf/hb-mangled-links-confirmation Mangled confirmation links fix GitOrigin-RevId: 334704a93159044a617b7373398a7f384b08783e --- .../app/src/Features/Email/Bodies/SingleCTAEmailBody.js | 4 ++-- services/web/app/src/Features/User/UserEmailsController.js | 7 ++++--- .../web/test/unit/src/User/UserEmailsControllerTests.js | 5 ++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/services/web/app/src/Features/Email/Bodies/SingleCTAEmailBody.js b/services/web/app/src/Features/Email/Bodies/SingleCTAEmailBody.js index 677ff32347..01d1bed090 100644 --- a/services/web/app/src/Features/Email/Bodies/SingleCTAEmailBody.js +++ b/services/web/app/src/Features/Email/Bodies/SingleCTAEmailBody.js @@ -33,8 +33,8 @@ module.exports = _.template(`\ <% } %>
 

- If the button above does not appear, please open the link in your browser here:
- <%= ctaURL %> + If the button above does not appear, please copy and paste this link into your browser's address bar:
+

<%= ctaURL %>

diff --git a/services/web/app/src/Features/User/UserEmailsController.js b/services/web/app/src/Features/User/UserEmailsController.js index 3529b79ec4..0b619299a3 100644 --- a/services/web/app/src/Features/User/UserEmailsController.js +++ b/services/web/app/src/Features/User/UserEmailsController.js @@ -137,14 +137,15 @@ module.exports = UserEmailsController = { confirm(req, res, next) { const { token } = req.body if (!token) { - return res.sendStatus(422) + return res.status(422).json({ + message: req.i18n.translate('confirmation_link_broken') + }) } UserEmailsConfirmationHandler.confirmEmailFromToken(token, function(error) { if (error) { if (error instanceof Errors.NotFoundError) { res.status(404).json({ - message: - 'Sorry, your confirmation token is invalid or has expired. Please request a new email confirmation link.' + message: req.i18n.translate('confirmation_token_invalid') }) } else { next(error) diff --git a/services/web/test/unit/src/User/UserEmailsControllerTests.js b/services/web/test/unit/src/User/UserEmailsControllerTests.js index 4c205ae5f7..8ca0e60d79 100644 --- a/services/web/test/unit/src/User/UserEmailsControllerTests.js +++ b/services/web/test/unit/src/User/UserEmailsControllerTests.js @@ -303,7 +303,7 @@ describe('UserEmailsController', function() { }) it('should return a 422 status', function() { - return this.res.sendStatus.calledWith(422).should.equal(true) + return this.res.status.calledWith(422).should.equal(true) }) }) @@ -319,8 +319,7 @@ describe('UserEmailsController', function() { this.res.status.calledWith(404).should.equal(true) return this.res.json .calledWith({ - message: - 'Sorry, your confirmation token is invalid or has expired. Please request a new email confirmation link.' + message: this.req.i18n.translate('confirmation_token_invalid') }) .should.equal(true) })