Get recaptcha token via callback
This commit is contained in:
parent
3c6a3f1d30
commit
82596e8ee9
1 changed files with 9 additions and 1 deletions
|
@ -21,15 +21,22 @@ class RegistrationView extends events.EventTarget {
|
|||
views.syncScrollPosition();
|
||||
views.decorateValidator(this._formNode);
|
||||
this._formNode.addEventListener("submit", (e) => this._evtSubmit(e));
|
||||
this.setRecaptchaToken = this.setRecaptchaToken.bind(this);
|
||||
this.renderRecaptcha();
|
||||
}
|
||||
|
||||
renderRecaptcha() {
|
||||
grecaptcha.render(this._recaptchaNode, {
|
||||
"sitekey": RECAPTCHA_SITE_KEY
|
||||
"callback": this.setRecaptchaToken,
|
||||
"sitekey": RECAPTCHA_SITE_KEY,
|
||||
});
|
||||
}
|
||||
|
||||
setRecaptchaToken(token) {
|
||||
console.log("Recaptcha token:", token);
|
||||
this.recaptchaToken = token;
|
||||
}
|
||||
|
||||
clearMessages() {
|
||||
views.clearMessages(this._hostNode);
|
||||
}
|
||||
|
@ -54,6 +61,7 @@ class RegistrationView extends events.EventTarget {
|
|||
name: this._userNameFieldNode.value,
|
||||
password: this._passwordFieldNode.value,
|
||||
email: this._emailFieldNode.value,
|
||||
recaptchaToken: this.recaptchaToken,
|
||||
},
|
||||
})
|
||||
);
|
||||
|
|
Reference in a new issue