From b770feadc8c10fc704b056a1eb7518c4c92cc6a5 Mon Sep 17 00:00:00 2001 From: June Kelly Date: Thu, 19 Aug 2021 10:37:18 +0100 Subject: [PATCH] Merge pull request #4743 from overleaf/hb-recaptcha-branding add recaptcha branding on login, registration, pw reset and share modal GitOrigin-RevId: dcdf3e7987a25712601aed2426cce2467eaecea3 --- services/web/app/views/_mixins/recaptcha.pug | 2 ++ services/web/app/views/user/passwordReset.pug | 6 ++++ services/web/app/views/user/reconfirm.pug | 5 +++ .../web/frontend/extracted-translations.json | 3 +- .../components/share-modal-body.js | 4 +++ .../components/symbol-palette-info-link.js | 2 +- .../shared/components/recaptcha-conditions.js | 32 +++++++++++++++++++ .../web/frontend/stylesheets/app/base.less | 6 ++++ services/web/locales/en.json | 1 + 9 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 services/web/app/views/_mixins/recaptcha.pug create mode 100644 services/web/frontend/js/shared/components/recaptcha-conditions.js diff --git a/services/web/app/views/_mixins/recaptcha.pug b/services/web/app/views/_mixins/recaptcha.pug new file mode 100644 index 0000000000..24e0c501ea --- /dev/null +++ b/services/web/app/views/_mixins/recaptcha.pug @@ -0,0 +1,2 @@ +mixin recaptchaConditions() + .recaptcha-branding !{translate("recaptcha_conditions", {}, [{}, {name: 'a', attrs: {href: 'https://policies.google.com/privacy', rel: 'noopener noreferrer', target: '_blank'}}, {name: 'a', attrs: {href: 'https://policies.google.com/terms', rel: 'noopener noreferrer', target: '_blank'}}])} diff --git a/services/web/app/views/user/passwordReset.pug b/services/web/app/views/user/passwordReset.pug index 12c09f1cc7..ce1522202a 100644 --- a/services/web/app/views/user/passwordReset.pug +++ b/services/web/app/views/user/passwordReset.pug @@ -1,4 +1,5 @@ extends ../layout +include ../_mixins/recaptcha block vars - metadata = { viewport: true } @@ -56,3 +57,8 @@ block content ) span(ng-hide="passwordResetForm.inflight") #{translate("request_password_reset")} span(ng-show="passwordResetForm.inflight") #{translate("requesting_password_reset")}… + + .row + .col-md-6.col-md-offset-3.col-lg-4.col-lg-offset-4 + if showCaptcha + +recaptchaConditions diff --git a/services/web/app/views/user/reconfirm.pug b/services/web/app/views/user/reconfirm.pug index 551ef09dfc..b2ff842598 100644 --- a/services/web/app/views/user/reconfirm.pug +++ b/services/web/app/views/user/reconfirm.pug @@ -1,4 +1,5 @@ extends ../layout +include ../_mixins/recaptcha block content - var email = reconfirm_email ? reconfirm_email : "" @@ -56,3 +57,7 @@ block content ng-disabled="reconfirmAccountForm.$invalid" aria-label=translate('request_password_reset_to_reconfirm') ) #{translate('request_password_reset_to_reconfirm')} + .row + .col-sm-12.col-md-6.col-md-offset-3 + if showCaptcha + +recaptchaConditions diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index 21f5993997..b68ef99f1b 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -213,7 +213,6 @@ "no_preview_available": "", "no_search_results": "", "no_symbols_found": "", - "showing_symbol_search_results": "", "normal": "", "off": "", "ok": "", @@ -256,6 +255,7 @@ "raw_logs_description": "", "read_only": "", "reauthorize_github_account": "", + "recaptcha_conditions": "", "recent_commits_in_github": "", "recompile": "", "recompile_from_scratch": "", @@ -290,6 +290,7 @@ "share_project": "", "share_with_your_collabs": "", "show_outline": "", + "showing_symbol_search_results": "", "something_went_wrong_rendering_pdf": "", "something_went_wrong_server": "", "somthing_went_wrong_compiling": "", diff --git a/services/web/frontend/js/features/share-project-modal/components/share-modal-body.js b/services/web/frontend/js/features/share-project-modal/components/share-modal-body.js index 8944ef2ea4..4d0624c647 100644 --- a/services/web/frontend/js/features/share-project-modal/components/share-modal-body.js +++ b/services/web/frontend/js/features/share-project-modal/components/share-modal-body.js @@ -7,6 +7,7 @@ import ViewMember from './view-member' import OwnerInfo from './owner-info' import SendInvitesNotice from './send-invites-notice' import { useProjectContext } from '../../../shared/context/project-context' +import RecaptchaConditions from '../../../shared/components/recaptcha-conditions' export default function ShareModalBody() { const { isAdmin } = useShareProjectContext() @@ -32,6 +33,9 @@ export default function ShareModalBody() { ))} {isAdmin ? : } + {!window.ExposedSettings.recaptchaDisabled?.invite && ( + + )} ) } diff --git a/services/web/frontend/js/features/symbol-palette/components/symbol-palette-info-link.js b/services/web/frontend/js/features/symbol-palette/components/symbol-palette-info-link.js index ba56cf2b10..a2a7036352 100644 --- a/services/web/frontend/js/features/symbol-palette/components/symbol-palette-info-link.js +++ b/services/web/frontend/js/features/symbol-palette/components/symbol-palette-info-link.js @@ -20,7 +20,7 @@ export default function SymbolPaletteInfoLink() { className="symbol-palette-info-link" href="https://www.overleaf.com/learn/latex/List_of_Greek_letters_and_math_symbols" target="_blank" - rel="noopener noreferer" + rel="noopener noreferrer" > diff --git a/services/web/frontend/js/shared/components/recaptcha-conditions.js b/services/web/frontend/js/shared/components/recaptcha-conditions.js new file mode 100644 index 0000000000..abf9b28294 --- /dev/null +++ b/services/web/frontend/js/shared/components/recaptcha-conditions.js @@ -0,0 +1,32 @@ +import { Trans } from 'react-i18next' + +export default function RecaptchaConditions() { + // the component link children below will be overwritten by the translation string + return ( +
+ + Privacy Policy + + ), + 2: ( + + Terms of Service + + ), + }} + /> +
+ ) +} diff --git a/services/web/frontend/stylesheets/app/base.less b/services/web/frontend/stylesheets/app/base.less index b590bb2381..3d3330d081 100644 --- a/services/web/frontend/stylesheets/app/base.less +++ b/services/web/frontend/stylesheets/app/base.less @@ -147,6 +147,12 @@ height: 0 !important; // Prevent layout shift } +.recaptcha-branding { + padding: @padding-sm @padding-sm 0 @padding-sm; + text-align: center; + font-size: @font-size-small; +} + .tos-agreement-notice { text-align: center; margin-top: (@line-height-computed / 4); diff --git a/services/web/locales/en.json b/services/web/locales/en.json index 2e54b6ce89..c19970b015 100644 --- a/services/web/locales/en.json +++ b/services/web/locales/en.json @@ -480,6 +480,7 @@ "tooltip_hide_filetree": "Click to hide the file-tree", "tooltip_show_filetree": "Click to show the file-tree", "cannot_verify_user_not_robot": "Sorry, we could not verify that you are not a robot. Please check that Google reCAPTCHA is not being blocked by an ad blocker or firewall.", + "recaptcha_conditions": "This site is protected by reCAPTCHA and the Google <1>Privacy Policy and <2>Terms of Service apply.", "uncompiled_changes": "Uncompiled Changes", "code_check_failed": "Code check failed", "code_check_failed_explanation": "Your code has errors that need to be fixed before the auto-compile can run",