Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appending same query param twice in components/g-recaptcha.js + unnecessary & at the end #82

Closed
Pixelik opened this issue Jan 8, 2024 · 2 comments · Fixed by #83
Closed

Comments

@Pixelik
Copy link
Contributor

Pixelik commented Jan 8, 2024

You append the same query param on line 65 and then on line 71

On line 66 you're also sometimes adding an empty string for no reason so you end up with an extra & at the end of the string in those cases

So in the end you end up with:

https://....?explicit=true&onload=...&&onload=...

Code should be:

  @action
  _initialize(element) {
    const globalName = `__ember_g_recaptcha_${this.elementId}_onload`

    window[globalName] = () => {
      this._render(element)
    }

    let baseUrl = [
      `${this.config['jsUrl'] || 'https://www.google.com/recaptcha/api.js'}?render=explicit`,
      `onload=${globalName}`
    ]

    if (this.config['hl']) {
      baseUrl.push(`hl=${this.config['hl']}`)
    }

    if (!this.options['skip']) {
      this._appendScript(baseUrl.join('&'))
    } else {
      this._render()
    }
  }
@sinankeskin
Copy link
Member

Hey @Pixelik thanks for the report. Whay do you think about creating a PR so can I merge quickly?

@Pixelik
Copy link
Contributor Author

Pixelik commented Jan 9, 2024

#83 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants