Skip to content
Code-Schnipsel Gruppen Projekte
Commit 362d3a1d erstellt von Patrick Müller's avatar Patrick Müller
Dateien durchsuchen

feat: input field for captcha response is now built automatically with CaptchaDisplay control

Übergeordneter 3b255fe6
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
......@@ -31,9 +31,11 @@ define('package/quiqqer/captcha/bin/controls/CaptchaDisplay', [
this.Loader = new QUILoader();
this.$CaptchaControl = null;
this.$ResponseInput = null;
this.addEvents({
onInject: this.$onInject
onInject: this.$onInject,
onImport: this.$onImport
});
},
......@@ -55,6 +57,44 @@ define('package/quiqqer/captcha/bin/controls/CaptchaDisplay', [
});
},
/**
* event: onImport
*/
$onImport: function () {
var self = this;
var CaptchaResponseInput = this.$Elm.getElement('input[name="captchaResponse"]');
if (!CaptchaResponseInput) {
return;
}
this.$ResponseInput = CaptchaResponseInput;
this.Loader.show();
this.getCaptchaControl().then(function (CaptchaControl) {
self.Loader.show();
CaptchaControl.addEvents({
onSuccess: function (response) {
CaptchaResponseInput.value = response;
},
onExpired: function () {
CaptchaResponseInput.value = '';
}
});
});
},
/**
* Get input for CAPTCHA response
*
* @return {null|HTMLInputElement}
*/
$getCaptchaResponseInput: function () {
return this.$ResponseInput;
},
/**
* Get Captcha control
*
......@@ -80,7 +120,7 @@ define('package/quiqqer/captcha/bin/controls/CaptchaDisplay', [
'package': 'quiqqer/captcha',
onError : reject
}
)
);
});
}
});
......
{$ModuleControl->create()}
\ No newline at end of file
{$ModuleControl->create()}
<input type="hidden" name="captchaResponse">
\ No newline at end of file
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren