mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 21:01:33 +02:00
20 lines
543 B
JavaScript
20 lines
543 B
JavaScript
import App from '../base'
|
|
|
|
export default App.factory('validateCaptchaV3', function () {
|
|
const grecaptcha = window.grecaptcha
|
|
const ExposedSettings = window.ExposedSettings
|
|
return function validateCaptchaV3(actionName, callback = () => {}) {
|
|
if (!grecaptcha) {
|
|
return
|
|
}
|
|
if (!ExposedSettings || !ExposedSettings.recaptchaSiteKeyV3) {
|
|
return
|
|
}
|
|
grecaptcha.ready(function () {
|
|
grecaptcha
|
|
.execute(ExposedSettings.recaptchaSiteKeyV3, { action: actionName })
|
|
.then(callback)
|
|
})
|
|
}
|
|
})
|