diff --git a/lib/captcha.component.ts b/lib/captcha.component.ts index 8a247e3..a92361d 100644 --- a/lib/captcha.component.ts +++ b/lib/captcha.component.ts @@ -32,7 +32,7 @@ export class ReCaptchaComponent implements OnInit, ControlValueAccessor { /* Available languages: https://developers.google.com/recaptcha/docs/language */ @Input() language: string = null; @Input() global: boolean = false; - + @Input() scriptUrl: string = 'www.google.com' @Output() captchaResponse = new EventEmitter(); @Output() captchaExpired = new EventEmitter(); @Output() loaded = new EventEmitter(); @@ -50,7 +50,7 @@ export class ReCaptchaComponent implements OnInit, ControlValueAccessor { } ngOnInit() { - this._captchaService.getReady(this.language, this.global) + this._captchaService.getReady(this.language, this.global, this.scriptUrl) .subscribe((ready) => { if (!ready) return; diff --git a/lib/captcha.service.ts b/lib/captcha.service.ts index 2922d36..0d75f54 100644 --- a/lib/captcha.service.ts +++ b/lib/captcha.service.ts @@ -25,9 +25,11 @@ export class ReCaptchaService { } } - public getReady(language: string, global: boolean): Observable { + public getReady(language: string, global: boolean, scriptUrl: string): Observable { if (!this.scriptLoaded) { - const scriptUrl = !!global ? 'www.recaptcha.net' : 'www.google.com'; + if (global == true){ + scriptUrl = 'www.recaptcha.net' + } this.scriptLoaded = true; let doc = document.body; let script = document.createElement('script');