Просмотр исходного кода

Merge pull request #2462 from overleaf/hb-mangled-links-confirmation

Mangled confirmation links fix

GitOrigin-RevId: 334704a93159044a617b7373398a7f384b08783e
nate stemen 6 лет назад
Родитель
Сommit
8253d0385c

+ 2 - 2
services/web/app/src/Features/Email/Bodies/SingleCTAEmailBody.js

@@ -33,8 +33,8 @@ module.exports = _.template(`\
 		<% } %>
 		<table class="spacer" style="border-collapse: collapse; border-spacing: 0; padding: 0; text-align: left; vertical-align: top; width: 100%;"><tbody><tr style="padding: 0; text-align: left; vertical-align: top;"><td height="20px" style="-moz-hyphens: auto; -webkit-hyphens: auto; Margin: 0; border-collapse: collapse !important; color: #5D6879; font-family: Helvetica, Arial, sans-serif; font-size: 20px; font-weight: normal; hyphens: auto; line-height: 20px; margin: 0; mso-line-height-rule: exactly; padding: 0; text-align: left; vertical-align: top; word-wrap: break-word;">&#xA0;</td></tr></tbody></table>
 		<p class="avoid-auto-linking" style="Margin: 0; Margin-bottom: 10px; color: #5D6879; font-family: Helvetica, Arial, sans-serif; font-size: 12px; font-weight: normal; margin: 0; margin-bottom: 10px; padding: 0; text-align: left;">
-			If the button above does not appear, please open the link in your browser here:<br>
-			<a href="<%= ctaURL %>"><%= ctaURL %></a>
+			If the button above does not appear, please copy and paste this link into your browser's address bar:<br>
+			<p class="avoid-auto-linking" style="Margin: 0; Margin-bottom: 10px; color: #5D6879; font-family: Helvetica, Arial, sans-serif; font-size: 12px; font-weight: normal; margin: 0; margin-bottom: 10px; padding: 0; text-align: left;"><%= ctaURL %></p>
 		</p>
 	</th>
 	<th class="expander" style="Margin: 0; color: #5D6879; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: normal; line-height: 1.3; margin: 0; padding: 0 !important; text-align: left; visibility: hidden; width: 0;"></th></tr></table></th>

+ 4 - 3
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)

+ 2 - 3
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)
       })