Merge pull request #4743 from overleaf/hb-recaptcha-branding

add recaptcha branding on login, registration, pw reset and share modal

GitOrigin-RevId: dcdf3e7987a25712601aed2426cce2467eaecea3
This commit is contained in:
June Kelly 2021-08-19 10:37:18 +01:00 committed by Copybot
parent 69e39e04f1
commit b770feadc8
9 changed files with 59 additions and 2 deletions

View file

@ -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'}}])}

View file

@ -1,4 +1,5 @@
extends ../layout extends ../layout
include ../_mixins/recaptcha
block vars block vars
- metadata = { viewport: true } - metadata = { viewport: true }
@ -56,3 +57,8 @@ block content
) )
span(ng-hide="passwordResetForm.inflight") #{translate("request_password_reset")} span(ng-hide="passwordResetForm.inflight") #{translate("request_password_reset")}
span(ng-show="passwordResetForm.inflight") #{translate("requesting_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

View file

@ -1,4 +1,5 @@
extends ../layout extends ../layout
include ../_mixins/recaptcha
block content block content
- var email = reconfirm_email ? reconfirm_email : "" - var email = reconfirm_email ? reconfirm_email : ""
@ -56,3 +57,7 @@ block content
ng-disabled="reconfirmAccountForm.$invalid" ng-disabled="reconfirmAccountForm.$invalid"
aria-label=translate('request_password_reset_to_reconfirm') aria-label=translate('request_password_reset_to_reconfirm')
) #{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

View file

@ -213,7 +213,6 @@
"no_preview_available": "", "no_preview_available": "",
"no_search_results": "", "no_search_results": "",
"no_symbols_found": "", "no_symbols_found": "",
"showing_symbol_search_results": "",
"normal": "", "normal": "",
"off": "", "off": "",
"ok": "", "ok": "",
@ -256,6 +255,7 @@
"raw_logs_description": "", "raw_logs_description": "",
"read_only": "", "read_only": "",
"reauthorize_github_account": "", "reauthorize_github_account": "",
"recaptcha_conditions": "",
"recent_commits_in_github": "", "recent_commits_in_github": "",
"recompile": "", "recompile": "",
"recompile_from_scratch": "", "recompile_from_scratch": "",
@ -290,6 +290,7 @@
"share_project": "", "share_project": "",
"share_with_your_collabs": "", "share_with_your_collabs": "",
"show_outline": "", "show_outline": "",
"showing_symbol_search_results": "",
"something_went_wrong_rendering_pdf": "", "something_went_wrong_rendering_pdf": "",
"something_went_wrong_server": "", "something_went_wrong_server": "",
"somthing_went_wrong_compiling": "", "somthing_went_wrong_compiling": "",

View file

@ -7,6 +7,7 @@ import ViewMember from './view-member'
import OwnerInfo from './owner-info' import OwnerInfo from './owner-info'
import SendInvitesNotice from './send-invites-notice' import SendInvitesNotice from './send-invites-notice'
import { useProjectContext } from '../../../shared/context/project-context' import { useProjectContext } from '../../../shared/context/project-context'
import RecaptchaConditions from '../../../shared/components/recaptcha-conditions'
export default function ShareModalBody() { export default function ShareModalBody() {
const { isAdmin } = useShareProjectContext() const { isAdmin } = useShareProjectContext()
@ -32,6 +33,9 @@ export default function ShareModalBody() {
))} ))}
{isAdmin ? <SendInvites /> : <SendInvitesNotice />} {isAdmin ? <SendInvites /> : <SendInvitesNotice />}
{!window.ExposedSettings.recaptchaDisabled?.invite && (
<RecaptchaConditions />
)}
</> </>
) )
} }

View file

@ -20,7 +20,7 @@ export default function SymbolPaletteInfoLink() {
className="symbol-palette-info-link" className="symbol-palette-info-link"
href="https://www.overleaf.com/learn/latex/List_of_Greek_letters_and_math_symbols" href="https://www.overleaf.com/learn/latex/List_of_Greek_letters_and_math_symbols"
target="_blank" target="_blank"
rel="noopener noreferer" rel="noopener noreferrer"
> >
<span className="info-badge" /> <span className="info-badge" />
</Button> </Button>

View file

@ -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 (
<div className="recaptcha-branding">
<Trans
i18nKey="recaptcha_conditions"
components={{
1: (
<a
rel="noopener noreferrer"
target="_blank"
href="https://policies.google.com/privacy"
>
Privacy Policy
</a>
),
2: (
<a
rel="noopener noreferrer"
target="_blank"
href="https://policies.google.com/terms"
>
Terms of Service
</a>
),
}}
/>
</div>
)
}

View file

@ -147,6 +147,12 @@
height: 0 !important; // Prevent layout shift 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 { .tos-agreement-notice {
text-align: center; text-align: center;
margin-top: (@line-height-computed / 4); margin-top: (@line-height-computed / 4);

View file

@ -480,6 +480,7 @@
"tooltip_hide_filetree": "Click to hide the file-tree", "tooltip_hide_filetree": "Click to hide the file-tree",
"tooltip_show_filetree": "Click to show 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.", "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</1> and <2>Terms of Service</2> apply.",
"uncompiled_changes": "Uncompiled Changes", "uncompiled_changes": "Uncompiled Changes",
"code_check_failed": "Code check failed", "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", "code_check_failed_explanation": "Your code has errors that need to be fixed before the auto-compile can run",