diff --git a/app/presenters/SignPresenter.php b/app/presenters/SignPresenter.php index 9e0b84bba..55351f5c0 100644 --- a/app/presenters/SignPresenter.php +++ b/app/presenters/SignPresenter.php @@ -1,194 +1,211 @@ -signInFactory->create(function (Form $form, $values) { - try { - $this->tapiAuthenticator->setTapiService($this->tapiService); - $this->user->setExpiration('20 minutes'); - $r = $this->user->login($values->name, $values->password); - } catch (APIException $exc) { - switch ($exc->getMessage()) { - case "Login not approved": - $this->flashMessage($this->translator->translate("common.alerts.loginNotApproved"), "danger"); - break; - default: - $this->flashMessage($this->translator->translate("common.alerts.loginNotSuccesfull") . ' (' . $exc->getMessage() . ")", "danger"); - break; - } - } - if(!is_null($this->user->getIdentity())) - Debugger::log($this->user->getIdentity()->data["callName"] . "@" . $this->supplier->getTym () . " logged in"); - $this->redirect('Homepage:'); - }); - - return $form; - } - - /** - * Sign-up form factory. - * @return Nette\Application\UI\Form - */ - protected function createComponentSignUpForm() { - return $this->signUpFactory->create(function () { - $this->flashMessage($this->translator->translate("common.alerts.registrationSuccesfull"), 'success'); - $this->redirect('Sign:In'); - }); - } - - /** - * PWD Lost form factory. - * @return Nette\Application\UI\Form - */ - protected function createComponentPwdLostForm() { - $form = $this->pwdLostFactory->create(); - $form->onSuccess[] = function (Nette\Application\UI\Form $form, stdClass $values) { - try { - $this->pwdLost->init() - ->setCallbackUri($this->link('//Sign:pwdreset') . "?code=%2s") - ->setHostname($this->getHttpRequest()->getRemoteHost()) - ->setMail($values->email) - ->getData(); - } catch (APIException $ex) { - $this->flashMessage($this->translator->translate("common.alerts.userNotFound")); - $this->redirect('Sign:pwdlost'); - } - - $this->flashMessage($this->translator->translate("common.alerts.resetCodeSent")); - - $this->redirect('Sign:pwdreset'); - }; - return $form; - } - - /** - * PWD Reset form factory. - * @return Nette\Application\UI\Form - */ - protected function createComponentPwdResetForm() { - $form = $this->pwdResetFactory->create(); - $form->onSuccess[] = function (Nette\Application\UI\Form $form, stdClass $values) { - $data = $this->resetPwd($values->code); - $this->flashMessage($this->translator->translate("common.alerts.resetCodeSent")); - $this->redirect('Sign:pwdnew', ["pwd" => $data]); - }; - return $form; - } - - public function actionOut() { - if (!is_null($this->getUser()->getIdentity())) { - $this->logout->init()->perform(); - $this->getUser()->logout(); - } - $this->flashMessage($this->translator->translate("common.alerts.logoutSuccesfull")); - $this->redirect('Sign:In'); - } - - public function renderPwdNew() { - $this->template->pwdNew = $this->getRequest()->getParameter("pwd"); - } - - public function renderPwdReset() { - if(($resetCode = $this->getRequest()->getParameter("code")) != null){ - $data = $this->resetPwd($resetCode); - $this->flashMessage($this->translator->translate("common.alerts.pwdResetSuccesfull")); - $this->redirect('Sign:pwdnew', ["pwd" => $data]); - } - } - - public function renderIn() { - $this->template->multiple = $this->supplier->getTapi_config()["multiple_team"]; - $is = $this->is->getData(); - $this->template->teamName = strtoupper($is->teamName); - $this->translator->setLocale(self::LOCALES[$is->defaultLanguageCode]); - - if ($tk = $this->getRequest()->getParameter("tk")) { - try { - $this->tapiAuthenticator->setTapiService($this->tapiService); - $this->tkLogin($tk); - } catch (APIException $exc) { - switch ($exc->getMessage()) { - case "Login not approved": - $this->flashMessage($this->translator->translate("common.alerts.loginNotApproved"), "danger"); - break; - default: - $this->flashMessage($this->translator->translate("common.alerts.loginNotSuccesfull") . ' (' . $exc->getMessage() . ")", "danger"); - break; - } - } - if (!is_null($this->user->getIdentity())) - Debugger::log($this->user->getIdentity()->data["callName"] . "@" . $this->supplier->getTym() . " logged in using transfer key"); - $this->redirect('Homepage:'); - } - } - - private function tkLogin($tk){ - $this->user->logout(true); - $this->user->login($this->tapiAuthenticator->tkAuthenticate($tk)); - } - - private function resetPwd($code){ - return $this->pwdReset->init() - ->setCode($code) - ->getData(); - } - -} +signInFactory->create(function (Form $form, $values) { + try { + $this->tapiAuthenticator->setTapiService($this->tapiService); + $this->user->setExpiration('20 minutes'); + $r = $this->user->login($values->name, $values->password); + } catch (APIException $exc) { + switch ($exc->getMessage()) { + case "Login not approved": + $this->flashMessage($this->translator->translate("common.alerts.loginNotApproved"), "danger"); + break; + default: + $this->flashMessage($this->translator->translate("common.alerts.loginNotSuccesfull") . ' (' . $exc->getMessage() . ")", "danger"); + break; + } + } + if(!is_null($this->user->getIdentity())) + Debugger::log($this->user->getIdentity()->data["callName"] . "@" . $this->supplier->getTym () . " logged in"); + $this->redirect('Homepage:'); + }); + + return $form; + } + + /** + * Sign-up form factory. + * @return Nette\Application\UI\Form + */ + protected function createComponentSignUpForm() { + return $this->signUpFactory->create(function () { + $this->flashMessage($this->translator->translate("common.alerts.registrationSuccesfull"), 'success'); + $this->redirect('Sign:In'); + }); + } + + /** + * PWD Lost form factory. + * @return Nette\Application\UI\Form + */ + protected function createComponentPwdLostForm() { + $form = $this->pwdLostFactory->create(); + $form->onSuccess[] = function (Nette\Application\UI\Form $form, stdClass $values) { + try { + $this->pwdLost->init() + ->setCallbackUri($this->link('//Sign:pwdreset') . "?code=%2s") + ->setHostname($this->getHttpRequest()->getRemoteHost()) + ->setMail($values->email) + ->getData(); + } catch (APIException $ex) { + $this->flashMessage($this->translator->translate("common.alerts.userNotFound")); + $this->redirect('Sign:pwdlost'); + } + + $this->flashMessage($this->translator->translate("common.alerts.resetCodeSent")); + + $this->redirect('Sign:pwdreset'); + }; + return $form; + } + + /** + * PWD Reset form factory. + * @return Nette\Application\UI\Form + */ + protected function createComponentPwdResetForm() { + $form = $this->pwdResetFactory->create(); + $form->onSuccess[] = function (Nette\Application\UI\Form $form, stdClass $values) { + $data = $this->resetPwd($values->code); + $this->flashMessage($this->translator->translate("common.alerts.resetCodeSent")); + $this->redirect('Sign:pwdnew', ["pwd" => $data]); + }; + return $form; + } + + public function actionOut() { + if (!is_null($this->getUser()->getIdentity())) { + $this->logout->init()->perform(); + $this->getUser()->logout(); + } + $this->flashMessage($this->translator->translate("common.alerts.logoutSuccesfull")); + $this->redirect('Sign:In'); + } + + public function renderPwdNew() { + $this->template->pwdNew = $this->getRequest()->getParameter("pwd"); + } + + public function renderPwdReset() { + if(($resetCode = $this->getRequest()->getParameter("code")) != null){ + $data = $this->resetPwd($resetCode); + $this->flashMessage($this->translator->translate("common.alerts.pwdResetSuccesfull")); + $this->redirect('Sign:pwdnew', ["pwd" => $data]); + } + } + + public function renderIn() { + $this->template->multiple = $this->supplier->getTapi_config()["multiple_team"]; + $this->template->forbidden = FALSE; + + try { + $is = $this->is->getData(); + } catch (APIException $exc) { + switch ($exc->getMessage()) { + case "API disabled": + $this->template->teamName = strtoupper($this->supplier->getTym()); + $this->template->forbidden = TRUE; + break; + default: + throw $exc; + } + return FALSE; + } + + + + $this->template->teamName = strtoupper($is->teamName); + $this->translator->setLocale(self::LOCALES[$is->defaultLanguageCode]); + + if ($tk = $this->getRequest()->getParameter("tk")) { + try { + $this->tapiAuthenticator->setTapiService($this->tapiService); + $this->tkLogin($tk); + } catch (APIException $exc) { + switch ($exc->getMessage()) { + case "Login not approved": + $this->flashMessage($this->translator->translate("common.alerts.loginNotApproved"), "danger"); + break; + default: + $this->flashMessage($this->translator->translate("common.alerts.loginNotSuccesfull") . ' (' . $exc->getMessage() . ")", "danger"); + break; + } + } + if (!is_null($this->user->getIdentity())) + Debugger::log($this->user->getIdentity()->data["callName"] . "@" . $this->supplier->getTym() . " logged in using transfer key"); + $this->redirect('Homepage:'); + } + } + + private function tkLogin($tk){ + $this->user->logout(true); + $this->user->login($this->tapiAuthenticator->tkAuthenticate($tk)); + } + + private function resetPwd($code){ + return $this->pwdReset->init() + ->setCode($code) + ->getData(); + } + +} diff --git a/app/presenters/templates/Sign/in.latte b/app/presenters/templates/Sign/in.latte index 6325563a4..0e00a410f 100644 --- a/app/presenters/templates/Sign/in.latte +++ b/app/presenters/templates/Sign/in.latte @@ -1,29 +1,41 @@ -{import '../components/unsecured.latte'} -{var $title = 'Login'} -{block content} -
- -
-
-

{$teamName}

- {form signInForm} -
-
{input name}
-
-
-
{input password}
-
-
-
{input team}
-
-
-
{input send}
-
- - {/form} -
-
+{import '../components/unsecured.latte'} +{var $title = 'Login'} +{block content} +
+
+
+
Tento portál je přístupný pouze týmům s licencí FULL. Více viz Licence
+
+
+
+ + +
+ +
+
+

{$teamName}

+ {form signInForm} +
+
+
{input name}
+
+
+
{input password}
+
+
+
{input team}
+
+
+
{input send}
+
{input send, class => 'disabled'}
+
+ +
+ {/form} +
+
\ No newline at end of file diff --git a/www/skins/black-panther/css/Sign/Sign.css b/www/skins/black-panther/css/Sign/Sign.css index 32a6c77b4..786b67c4f 100644 --- a/www/skins/black-panther/css/Sign/Sign.css +++ b/www/skins/black-panther/css/Sign/Sign.css @@ -37,7 +37,7 @@ INPUT[type='submit']:hover { background: linear-gradient(to bottom right, #ff5f49, #d14836); } -A{ +FORM A{ display: block; background: linear-gradient(to bottom right, #d0d0d0, #bbbbbb); color: white; @@ -46,7 +46,7 @@ A{ font-size: 14px; } -A:hover{ +FORM A:hover{ color: white; text-decoration: none; background: linear-gradient(to bottom right, #d0d0d0, #616161); @@ -59,6 +59,19 @@ DIV.brand{ background: linear-gradient(to bottom right, #333030, #403b3b); } +INPUT.disabled{ + cursor: not-allowed; + color: #868e96; +} + +INPUT.disabled:hover{ + text-decoration: none; +} + +.form-box.disabled{ + opacity: 0.8; +} + form th, form td { font-weight: normal; } diff --git a/www/skins/hell-boy/css/Sign/Sign.css b/www/skins/hell-boy/css/Sign/Sign.css index 32a6c77b4..786b67c4f 100644 --- a/www/skins/hell-boy/css/Sign/Sign.css +++ b/www/skins/hell-boy/css/Sign/Sign.css @@ -37,7 +37,7 @@ INPUT[type='submit']:hover { background: linear-gradient(to bottom right, #ff5f49, #d14836); } -A{ +FORM A{ display: block; background: linear-gradient(to bottom right, #d0d0d0, #bbbbbb); color: white; @@ -46,7 +46,7 @@ A{ font-size: 14px; } -A:hover{ +FORM A:hover{ color: white; text-decoration: none; background: linear-gradient(to bottom right, #d0d0d0, #616161); @@ -59,6 +59,19 @@ DIV.brand{ background: linear-gradient(to bottom right, #333030, #403b3b); } +INPUT.disabled{ + cursor: not-allowed; + color: #868e96; +} + +INPUT.disabled:hover{ + text-decoration: none; +} + +.form-box.disabled{ + opacity: 0.8; +} + form th, form td { font-weight: normal; } diff --git a/www/skins/silver-surfer/css/Sign/Sign.css b/www/skins/silver-surfer/css/Sign/Sign.css index 32a6c77b4..786b67c4f 100644 --- a/www/skins/silver-surfer/css/Sign/Sign.css +++ b/www/skins/silver-surfer/css/Sign/Sign.css @@ -37,7 +37,7 @@ INPUT[type='submit']:hover { background: linear-gradient(to bottom right, #ff5f49, #d14836); } -A{ +FORM A{ display: block; background: linear-gradient(to bottom right, #d0d0d0, #bbbbbb); color: white; @@ -46,7 +46,7 @@ A{ font-size: 14px; } -A:hover{ +FORM A:hover{ color: white; text-decoration: none; background: linear-gradient(to bottom right, #d0d0d0, #616161); @@ -59,6 +59,19 @@ DIV.brand{ background: linear-gradient(to bottom right, #333030, #403b3b); } +INPUT.disabled{ + cursor: not-allowed; + color: #868e96; +} + +INPUT.disabled:hover{ + text-decoration: none; +} + +.form-box.disabled{ + opacity: 0.8; +} + form th, form td { font-weight: normal; }