Skip to content

Commit

Permalink
Merge pull request #83 from Pixelik/patch-1
Browse files Browse the repository at this point in the history
fix: google-recaptcha script URL query params
  • Loading branch information
sinankeskin authored Jan 9, 2024
2 parents b2fb2ef + 16c9387 commit 0a05fa0
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions addon/components/g-recaptcha.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,23 @@ export default class GRecaptchaComponent extends Component {

@action
_initialize(element) {
window[`__ember_g_recaptcha_${this.elementId}_onload`] = () => {
const globalName = `__ember_g_recaptcha_${this.elementId}_onload`;

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

const baseUrl = [
`${
this.config['jsUrl'] || 'https://www.google.com/recaptcha/api.js'
}?render=explicit`,
`onload=__ember_g_recaptcha_${this.elementId}_onload`,
this.config['hl'] ? `hl=${this.config['hl']}` : '',
].join('&');
let baseUrl = [
`${this.config['jsUrl'] || 'https://www.google.com/recaptcha/api.js'}?render=explicit`,

Check failure on line 64 in addon/components/g-recaptcha.js

View workflow job for this annotation

GitHub Actions / Linters

Replace `this.config['jsUrl']·||·'https://www.google.com/recaptcha/api.js'` with `⏎········this.config['jsUrl']·||·'https://www.google.com/recaptcha/api.js'⏎······`
`onload=${globalName}`

Check failure on line 65 in addon/components/g-recaptcha.js

View workflow job for this annotation

GitHub Actions / Linters

Insert `,`
];

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

if (!this.options['skip']) {
this._appendScript(
`${baseUrl}&onload=__ember_g_recaptcha_${this.elementId}_onload`
);
this._appendScript(baseUrl.join('&'));
} else {
this._render();
}
Expand Down

0 comments on commit 0a05fa0

Please sign in to comment.