Commit 1bcdf841 authored by Henning Leutz's avatar Henning Leutz 🥋

Merge branch 'dev'

parents e4b72faf 14b4efe4
......@@ -74,7 +74,7 @@ define('package/quiqqer/frontend-users/bin/frontend/controls/RegistrationSignUp'
if (Redirect) {
var redirectUrl = Redirect.get('data-redirecturl');
(function() {
(function () {
window.location = redirectUrl;
}).delay(5000);
}
......@@ -112,6 +112,10 @@ define('package/quiqqer/frontend-users/bin/frontend/controls/RegistrationSignUp'
this.$RegistrationSection.setStyle('opacity', 0);
this.$RegistrationSection.setStyle('display', 'inline');
if (!this.$TextSection) {
this.$TextSection = new Element('div'); // fake element
}
this.$TextSection.setStyle('opacity', 0);
this.$TextSection.setStyle('display', 'inline');
......
......@@ -41,14 +41,15 @@ define('package/quiqqer/frontend-users/bin/frontend/controls/login/Login', [
],
options: {
showLoader : true,
onSuccess : false,
redirect : true,
header : true,
authenticators: [], // fixed list of authenticators shown
mail : true,
passwordReset : true,
reload : true
showLoader : true,
onSuccess : false,
redirect : true,
header : true,
authenticators : [], // fixed list of authenticators shown
mail : true,
passwordReset : true,
reload : true,
ownRedirectOnLogin: false // function
},
initialize: function (options) {
......@@ -94,11 +95,13 @@ define('package/quiqqer/frontend-users/bin/frontend/controls/login/Login', [
this.Loader.show();
}
new Element('div', {
html: ''
}).inject(this.getElm());
var Elm = this.getElm();
console.log('Not implemented yet');
if (this.getAttribute('header') === false) {
Elm.getElement('h2').destroy();
}
this.$parseQuiControls();
},
/**
......@@ -107,7 +110,6 @@ define('package/quiqqer/frontend-users/bin/frontend/controls/login/Login', [
$onInject: function () {
var self = this;
// @todo loader
if (this.getAttribute('showLoader')) {
this.Loader.show();
}
......@@ -130,77 +132,87 @@ define('package/quiqqer/frontend-users/bin/frontend/controls/login/Login', [
Ghost.getElements('style').inject(self.getElm());
QUI.parse(self.getElm()).then(function () {
var Login = self.getElm().getElement('.quiqqer-fu-login-container');
Login.setStyle('opacity', 0);
Login.setStyle('display', null);
self.$parseQuiControls();
}, {
'package' : 'quiqqer/frontend-users',
authenticators: JSON.encode(this.getAttribute('authenticators')),
mail : this.getAttribute('mail') ? 1 : 0,
passwordReset : this.getAttribute('passwordReset') ? 1 : 0
});
},
self.getElm()
.getElements('form[name="quiqqer-fu-login-email"]')
.addEvent('submit', function (event) {
event.stop();
self.authByEmail();
});
/**
* parse qui controls for loading
*/
$parseQuiControls: function () {
var self = this;
QUI.parse(this.getElm()).then(function () {
var Login = self.getElm().getElement('.quiqqer-fu-login-container');
self.getElm()
.getElements('.quiqqer-fu-login-social-entry')
.addEvent('click', self.$auth);
Login.setStyle('opacity', 0);
Login.setStyle('display', null);
self.getElm().getElements(
'.quiqqer-fu-login-forget-password-link a'
).addEvent('click', function (event) {
self.getElm()
.getElements('form[name="quiqqer-fu-login-email"]')
.addEvent('submit', function (event) {
event.stop();
self.openForgottenPassword();
self.authByEmail();
});
self.getElm().getElements(
'.quiqqer-fu-login-forget-password-reset [name="cancel"]'
).addEvent('click', function (event) {
event.stop();
self.closeForgottenPassword();
});
self.getElm().getElements(
'.quiqqer-fu-login-forget-password-reset [type="submit"]'
).addEvent('click', function (event) {
event.stop();
self.sendForgottenPassword();
});
self.getElm()
.getElements('.quiqqer-fu-login-social-entry')
.addEvent('click', self.$auth);
self.getElm().getElements(
'.quiqqer-fu-login-forget-password-link a'
).addEvent('click', function (event) {
event.stop();
self.openForgottenPassword();
});
// submit events
var container = self.getElm().getElements('.quiqqer-fu-login-social-entry-control');
var i, len, Control, ControlDom;
self.getElm().getElements(
'.quiqqer-fu-login-forget-password-reset [name="cancel"]'
).addEvent('click', function (event) {
event.stop();
self.closeForgottenPassword();
});
for (i = 0, len = container.length; i < len; i++) {
ControlDom = container[i].getFirst();
Control = QUI.Controls.getById(ControlDom.get('data-quiid'));
self.getElm().getElements(
'.quiqqer-fu-login-forget-password-reset [type="submit"]'
).addEvent('click', function (event) {
event.stop();
self.sendForgottenPassword();
});
//Control.addEvent('');
}
self.getElm().getElements('form.quiqqer-fu-login-social-entry').addEvents({
submit: self.$authBySocial
});
// submit events
var container = self.getElm().getElements('.quiqqer-fu-login-social-entry-control');
var i, len, Control, ControlDom;
for (i = 0, len = container.length; i < len; i++) {
ControlDom = container[i].getFirst();
Control = QUI.Controls.getById(ControlDom.get('data-quiid'));
moofx(Login).animate({
opacity: 1
}, {
callback: function () {
self.Loader.hide();
self.fireEvent('load', [self]);
QUI.fireEvent('quiqqerUserAuthLoginLoad', [self]);
}
});
//Control.addEvent('');
}
self.getElm().getElements('form.quiqqer-fu-login-social-entry').addEvents({
submit: self.$authBySocial
});
moofx(Login).animate({
opacity: 1
}, {
callback: function () {
self.Loader.hide();
self.fireEvent('load', [self]);
QUI.fireEvent('quiqqerUserAuthLoginLoad', [self]);
}
});
}, {
'package' : 'quiqqer/frontend-users',
authenticators: JSON.encode(this.getAttribute('authenticators')),
mail : this.getAttribute('mail') ? 1 : 0,
passwordReset : this.getAttribute('passwordReset') ? 1 : 0
});
},
......@@ -286,6 +298,11 @@ define('package/quiqqer/frontend-users/bin/frontend/controls/login/Login', [
return;
}
if (self.getAttribute('ownRedirectOnLogin')) {
self.getAttribute('ownRedirectOnLogin')();
return;
}
if (redirect) {
window.location = redirect;
return;
......@@ -408,6 +425,11 @@ define('package/quiqqer/frontend-users/bin/frontend/controls/login/Login', [
return;
}
if (self.getAttribute('ownRedirectOnLogin')) {
self.getAttribute('ownRedirectOnLogin')();
return;
}
if (result) {
window.location = result;
}
......
811fd0851160df2a685c73c21168fb36 composer.json
ddac50695f20b988d62c9123d8d3fd5e README.md
......@@ -13,6 +13,10 @@
width: 40%;
}
.quiqqer-fu-registrationSignUp-registration-content {
width: 100%;
}
.quiqqer-fu-registrationSignUp-info {
text-align: left;
}
......
......@@ -4,7 +4,9 @@
</div>
</noscript>
<section class="quiqqer-fu-registrationSignUp-registration" style="display: none">
<section class="quiqqer-fu-registrationSignUp-registration{if $hasNoContent} quiqqer-fu-registrationSignUp-registration-content{/if}"
style="display: none"
>
{if $showLoggedInWarning}
<div class="quiqqer-fu-registrationSignUp-registration-logged-in message-information">
{locale group="quiqqer/frontend-users" var="message.types.registration.already_registered"}
......@@ -125,6 +127,8 @@
{/if}
</section>
{if $this->getAttribute('content') !== false}
<section class="quiqqer-fu-registrationSignUp-info" style="display: none">
{$this->getAttribute('content')}
</section>
{/if}
\ No newline at end of file
......@@ -44,7 +44,7 @@ class RegistrationSignUp extends QUI\Control
$this->id = QUI\FrontendUsers\Handler::getInstance()->createRegistrationId();
$this->addCSSFile(dirname(__FILE__).'/RegistrationSignUp.css');
$this->addCSSFile(\dirname(__FILE__).'/RegistrationSignUp.css');
$this->addCSSClass('quiqqer-fu-registrationSignUp');
$this->setJavaScriptControl(
......@@ -95,12 +95,12 @@ class RegistrationSignUp extends QUI\Control
if (QUI\FrontendUsers\Utils::isCaptchaModuleInstalled()) {
$Captcha = new QUI\Captcha\Controls\CaptchaDisplay();
$jsRequired = QUI\Captcha\Handler::requiresJavaScript();
$useCaptcha = boolval($registrationSettings['useCaptcha']);
$useCaptcha = \boolval($registrationSettings['useCaptcha']);
$Default = QUI\Captcha\Handler::getDefaultCaptchaModuleControl();
$isCaptchaInvisible = QUI\Captcha\Handler::isInvisible();
if (class_exists('QUI\Captcha\Modules\Google')
if (\class_exists('QUI\Captcha\Modules\Google')
&& $Default->getType() === QUI\Captcha\Modules\GoogleInvisible\Control::class) {
$Engine->assign('googleSideKey', QUI\Captcha\Modules\Google::getSiteKey());
}
......@@ -112,16 +112,17 @@ class RegistrationSignUp extends QUI\Control
'Captcha' => $Captcha,
'useCaptcha' => $useCaptcha,
'jsRequired' => $jsRequired,
'isCaptchaInvisible' => $isCaptchaInvisible
'isCaptchaInvisible' => $isCaptchaInvisible,
'hasNoContent' => $this->getAttribute('content') === false
]);
$Engine->assign([
'captchaHTML' => $Engine->fetch(dirname(__FILE__).'/RegistrationSignUp.Captcha.html')
'captchaHTML' => $Engine->fetch(\dirname(__FILE__).'/RegistrationSignUp.Captcha.html')
]);
// default stuff
$Registrars = $Registrars->filter(function ($Registrar) {
$class = get_class($Registrar);
$class = \get_class($Registrar);
$haystack = [
QUI\FrontendUsers\Registrars\Email\Registrar::class
];
......@@ -130,15 +131,15 @@ class RegistrationSignUp extends QUI\Control
$haystack[] = QUI\Registration\Trial\Registrar::class;
}
$haystack = array_flip($haystack);
$haystack = \array_flip($haystack);
return !isset($haystack[$class]);
});
// Sort registrars by display position
$Registrars->sort(function ($RegistrarA, $RegistrarB) use ($RegistrarHandler) {
$settingsA = $RegistrarHandler->getRegistrarSettings(get_class($RegistrarA));
$settingsB = $RegistrarHandler->getRegistrarSettings(get_class($RegistrarB));
$settingsA = $RegistrarHandler->getRegistrarSettings(\get_class($RegistrarA));
$settingsB = $RegistrarHandler->getRegistrarSettings(\get_class($RegistrarB));
$displayPositionA = (int)$settingsA['displayPosition'];
$displayPositionB = (int)$settingsB['displayPosition'];
......@@ -230,7 +231,7 @@ class RegistrationSignUp extends QUI\Control
'redirect' => $redirect
]);
return $Engine->fetch(dirname(__FILE__).'/RegistrationSignUp.html');
return $Engine->fetch(\dirname(__FILE__).'/RegistrationSignUp.html');
}
/**
......@@ -251,9 +252,9 @@ class RegistrationSignUp extends QUI\Control
$registrars = $Registrars->toArray();
$FilteredRegistrars = new QUI\FrontendUsers\RegistrarCollection();
$registrars = array_filter($registrars, function ($Registrar) use ($filterRegistrars) {
$registrars = \array_filter($registrars, function ($Registrar) use ($filterRegistrars) {
/** @var QUI\FrontendUsers\RegistrarInterface $Registrar */
return in_array($Registrar->getType(), $filterRegistrars);
return \in_array($Registrar->getType(), $filterRegistrars);
});
foreach ($registrars as $Registrar) {
......
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