Commit ac7af93b authored by Henning Leutz's avatar Henning Leutz 🥋

feat: controls/users/Login -> add onLoad event

parent 68f63a24
/** /**
* @module controls/users/Login * @module controls/users/Login
* *
* @event onLoad
* @event onAuthBegin * @event onAuthBegin
* @event onAuthNext * @event onAuthNext
* @event onSuccess * @event onSuccess
...@@ -85,9 +86,13 @@ define('controls/users/Login', [ ...@@ -85,9 +86,13 @@ define('controls/users/Login', [
this.Loader.show(); this.Loader.show();
} }
var self = this;
QUIAjax.get('ajax_users_loginControl', function (result) { QUIAjax.get('ajax_users_loginControl', function (result) {
this.$buildAuthenticator(result); self.$buildAuthenticator(result).then(function () {
}.bind(this), { self.fireEvent('load', [self]);
});
}, {
isAdminLogin : typeof QUIQQER_IS_ADMIN_LOGIN !== 'undefined' ? 1 : 0, isAdminLogin : typeof QUIQQER_IS_ADMIN_LOGIN !== 'undefined' ? 1 : 0,
authenticators: JSON.encode(this.getAttribute('authenticators')) authenticators: JSON.encode(this.getAttribute('authenticators'))
}); });
...@@ -105,6 +110,7 @@ define('controls/users/Login', [ ...@@ -105,6 +110,7 @@ define('controls/users/Login', [
} }
this.$refreshForm(); this.$refreshForm();
this.fireEvent('load', [this]);
}, },
/** /**
...@@ -152,6 +158,7 @@ define('controls/users/Login', [ ...@@ -152,6 +158,7 @@ define('controls/users/Login', [
* Build the authenticator from the ajax html * Build the authenticator from the ajax html
* *
* @param {String} html * @param {String} html
* @return {Promise}
*/ */
$buildAuthenticator: function (html) { $buildAuthenticator: function (html) {
var Container = new Element('div', { var Container = new Element('div', {
...@@ -169,7 +176,8 @@ define('controls/users/Login', [ ...@@ -169,7 +176,8 @@ define('controls/users/Login', [
QUIAjax.post('ajax_user_logout', function () { QUIAjax.post('ajax_user_logout', function () {
window.location.reload(); window.location.reload();
}); });
return;
return Promise.resolve();
} }
forms.setStyle('opacity', 0); forms.setStyle('opacity', 0);
...@@ -189,7 +197,7 @@ define('controls/users/Login', [ ...@@ -189,7 +197,7 @@ define('controls/users/Login', [
Child.inject(forms[0]); Child.inject(forms[0]);
}); });
QUI.parse(forms).then(function () { return QUI.parse(forms).then(function () {
this.Loader.hide(); this.Loader.hide();
forms.setStyle('top', 20); forms.setStyle('top', 20);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment