mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #4233 from overleaf/hb-double-click-login
Ensure inflight is set before recaptcha is called GitOrigin-RevId: fb2195c46089ddd4e0239a04d98c2650e05ad1c6
This commit is contained in:
parent
8742a29d80
commit
f691e22c19
2 changed files with 7 additions and 3 deletions
|
@ -24,6 +24,10 @@ App.directive('asyncForm', ($http, validateCaptcha, validateCaptchaV3) => ({
|
||||||
attrs.newEmail
|
attrs.newEmail
|
||||||
|
|
||||||
const validateCaptchaIfEnabled = function (callback) {
|
const validateCaptchaIfEnabled = function (callback) {
|
||||||
|
scope.$applyAsync(() => {
|
||||||
|
scope[attrs.name].inflight = true
|
||||||
|
})
|
||||||
|
|
||||||
if (attrs.captchaActionName) {
|
if (attrs.captchaActionName) {
|
||||||
validateCaptchaV3(attrs.captchaActionName)
|
validateCaptchaV3(attrs.captchaActionName)
|
||||||
}
|
}
|
||||||
|
@ -34,7 +38,7 @@ App.directive('asyncForm', ($http, validateCaptcha, validateCaptchaV3) => ({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const submitRequest = function (grecaptchaResponse) {
|
const _submitRequest = function (grecaptchaResponse) {
|
||||||
const formData = {}
|
const formData = {}
|
||||||
for (const data of Array.from(element.serializeArray())) {
|
for (const data of Array.from(element.serializeArray())) {
|
||||||
formData[data.name] = data.value
|
formData[data.name] = data.value
|
||||||
|
@ -46,7 +50,6 @@ App.directive('asyncForm', ($http, validateCaptcha, validateCaptchaV3) => ({
|
||||||
|
|
||||||
// clear the response object which may be referenced downstream
|
// clear the response object which may be referenced downstream
|
||||||
Object.keys(response).forEach(field => delete response[field])
|
Object.keys(response).forEach(field => delete response[field])
|
||||||
scope[attrs.name].inflight = true
|
|
||||||
|
|
||||||
// for asyncForm prevent automatic redirect to /login if
|
// for asyncForm prevent automatic redirect to /login if
|
||||||
// authentication fails, we will handle it ourselves
|
// authentication fails, we will handle it ourselves
|
||||||
|
@ -143,7 +146,7 @@ App.directive('asyncForm', ($http, validateCaptcha, validateCaptchaV3) => ({
|
||||||
}
|
}
|
||||||
|
|
||||||
const submit = () =>
|
const submit = () =>
|
||||||
validateCaptchaIfEnabled(response => submitRequest(response))
|
validateCaptchaIfEnabled(response => _submitRequest(response))
|
||||||
|
|
||||||
const _httpRequestFn = (method = 'post') => {
|
const _httpRequestFn = (method = 'post') => {
|
||||||
const $HTTP_FNS = {
|
const $HTTP_FNS = {
|
||||||
|
|
|
@ -144,6 +144,7 @@
|
||||||
|
|
||||||
.grecaptcha-badge {
|
.grecaptcha-badge {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
|
height: 0 !important; // Prevent layout shift
|
||||||
}
|
}
|
||||||
|
|
||||||
.tos-agreement-notice {
|
.tos-agreement-notice {
|
||||||
|
|
Loading…
Reference in a new issue