filebrowser / docs

📄 Who doesn't like documentation?
58 stars 39 forks source link

racing condition when using grecaptcha #21

Closed parsermerge closed 4 years ago

parsermerge commented 4 years ago

I have enabled recaptcha using file browser config however, there seems to be a racing condition when loading the captcha, as the plugin may not have been loaded form google yet. Here it is using version 2.9.0:

vue.esm.js:1897 TypeError: window.grecaptcha.render is not a function
    at o.mounted (Login.vue:44)
    at at (vue.esm.js:1863)
    at In (vue.esm.js:4222)
    at Object.insert (vue.esm.js:3148)
    at H (vue.esm.js:6351)
    at kr.__patch__ (vue.esm.js:6570)
    at kr.Pn.e._update (vue.esm.js:3948)
    at kr.r (vue.esm.js:4069)
    at ar.get (vue.esm.js:4482)
    at new ar (vue.esm.js:4471)

from code:

  mounted () {
    if (!recaptcha) return

    window.grecaptcha.render('recaptcha', {.  // <-- the issue
      sitekey: recaptchaKey
    })
  },