public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer) { $ret = parent::getTemplateVars($renderer); $users = Kwf_Registry::get('userModel'); $showPassword = false; //is there a password auth? foreach ($users->getAuthMethods() as $auth) { if ($auth instanceof Kwf_User_Auth_Interface_Password) { $showPassword = true; } } if ($showPassword) { //if a redirect auth doesn't allow password hide it foreach ($users->getAuthMethods() as $auth) { if ($auth instanceof Kwf_User_Auth_Interface_Redirect) { $user = $this->getData()->getChildComponent('-form')->getComponent()->getUserRow(); if (!$auth->allowPasswordForUser($user)) { $showPassword = false; } } } } $ret['showPassword'] = $showPassword; $ret['redirects'] = array(); foreach ($users->getAuthMethods() as $authKey => $auth) { if ($auth instanceof Kwf_User_Auth_Interface_Redirect && $auth->showInFrontend()) { $label = $auth->getLoginRedirectLabel(); $ret['redirects'][] = array('url' => $this->getData()->url, 'code' => $_GET['code'], 'authMethod' => $authKey, 'name' => $this->getData()->trlStaticExecute($label['name']), 'icon' => isset($label['icon']) ? '/assets/' . $label['icon'] : false, 'formOptions' => Kwf_User_Auth_Helper::getRedirectFormOptionsHtml($auth->getLoginRedirectFormOptions())); } } return $ret; }
public function getTemplateVars() { $ret = parent::getTemplateVars(); $ret['register'] = $this->_getRegisterComponent(); $ret['lostPassword'] = $this->_getLostPasswordComponent(); $ret['redirects'] = array(); foreach (Kwf_Registry::get('userModel')->getAuthMethods() as $authKey => $auth) { if ($auth instanceof Kwf_User_Auth_Interface_Redirect && $auth->showInFrontend()) { $label = $auth->getLoginRedirectLabel(); $ret['redirects'][] = array('url' => $this->getData()->url, 'authMethod' => $authKey, 'redirect' => '%redirect%', 'name' => $this->getData()->trlStaticExecute($label['name']), 'icon' => isset($label['icon']) ? '/assets/' . $label['icon'] : false, 'formOptions' => Kwf_User_Auth_Helper::getRedirectFormOptionsHtml($auth->getLoginRedirectFormOptions())); } } return $ret; }
public function indexAction() { $this->view->contentScript = $this->getHelper('viewRenderer')->getViewScript('activate'); $this->view->email = $this->_getParam('user')->email; $this->view->isActivate = $this->_getParam('user')->isActivated(); $users = Kwf_Registry::get('userModel'); $showPassword = false; //is there a password auth? foreach ($users->getAuthMethods() as $auth) { if ($auth instanceof Kwf_User_Auth_Interface_Password) { $showPassword = true; } } //if a redirect auth doesn't allow password hide it foreach ($users->getAuthMethods() as $auth) { if ($auth instanceof Kwf_User_Auth_Interface_Redirect) { if (!$auth->allowPasswordForUser($this->getParam('user'))) { $showPassword = false; } } } $this->view->showPassword = $showPassword; if ($showPassword) { $url = $this->getFrontController()->getRouter()->assemble(array('controller' => 'backend-change-password', 'action' => 'index'), 'kwf_user'); $url .= '?code=' . $this->_getParam('code'); $this->view->passwordUrl = $url; } $this->view->redirects = array(); foreach ($users->getAuthMethods() as $k => $auth) { if ($auth instanceof Kwf_User_Auth_Interface_Redirect && $auth->showInBackend()) { $url = $this->getFrontController()->getRouter()->assemble(array('controller' => 'backend-activate', 'action' => 'redirect'), 'kwf_user'); $label = $auth->getLoginRedirectLabel(); $this->view->redirects[] = array('url' => $url, 'authMethod' => $k, 'code' => $this->_getParam('code'), 'redirect' => $_SERVER['REQUEST_URI'], 'name' => Kwf_Trl::getInstance()->trlStaticExecute($label['name']), 'icon' => isset($label['icon']) ? '/assets/' . $label['icon'] : false, 'formOptions' => Kwf_User_Auth_Helper::getRedirectFormOptionsHtml($auth->getLoginRedirectFormOptions())); } } if (count($this->view->redirects) == 1 && !$showPassword) { $this->redirect($this->view->redirects[0]['url'], array('prependBase' => false)); } else { if (count($this->view->redirects) == 0 && $showPassword) { $this->redirect($this->view->passwordUrl, array('prependBase' => false)); } } }
public function indexAction() { $this->view->applicationName = Kwf_Config::getValue('application.name'); $this->view->brandingKoala = Kwf_Config::getValue('application.branding.koala'); $this->view->brandingVividPlanet = Kwf_Config::getValue('application.branding.vividPlanet'); $this->view->pages = Kwf_Registry::get('acl')->has('kwf_component_pages'); $this->view->baseUrl = Kwf_Setup::getBaseUrl(); $this->view->favicon = Kwf_View_Ext::getFavicon(); try { $t = new Kwf_Util_Model_Welcome(); $row = $t->getRow(1); } catch (Zend_Db_Statement_Exception $e) { //wenn tabelle nicht existiert fehler abfangen $row = null; } if ($row && ($fileRow = $row->getParentRow('LoginImage'))) { $this->view->image = Kwf_Media::getUrlByRow($row, 'LoginImageLarge', 'login'); $this->view->imageSize = Kwf_Media_Image::calculateScaleDimensions($fileRow->getImageDimensions(), Kwf_Util_Model_Welcome::getImageDimensions('LoginImageLarge')); } else { $this->view->image = false; } if (Kwf_Registry::get('config')->allowUntagged === true) { if (file_exists('.git') && Kwf_Util_Git::web()->getActiveBranch() != 'production') { $this->view->untagged = true; } if (file_exists(KWF_PATH . '/.git') && Kwf_Util_Git::kwf()->getActiveBranch() != 'production/' . Kwf_Registry::get('config')->application->id) { $this->view->untagged = true; } } $this->view->contentScript = $this->getHelper('viewRenderer')->getViewScript('login'); $this->view->lostPasswordLink = $this->getFrontController()->getRouter()->assemble(array('controller' => 'login', 'action' => 'lost-password'), 'kwf_user'); $this->view->redirects = array(); $users = Zend_Registry::get('userModel'); foreach ($users->getAuthMethods() as $k => $auth) { if ($auth instanceof Kwf_User_Auth_Interface_Redirect && $auth->showInBackend()) { $url = $this->getFrontController()->getRouter()->assemble(array('controller' => 'backend-login', 'action' => 'redirect'), 'kwf_user'); $label = $auth->getLoginRedirectLabel(); $this->view->redirects[] = array('url' => $url, 'authMethod' => $k, 'redirect' => $_SERVER['REQUEST_URI'], 'name' => Kwf_Trl::getInstance()->trlStaticExecute($label['name']), 'icon' => isset($label['icon']) ? '/assets/' . $label['icon'] : false, 'formOptions' => Kwf_User_Auth_Helper::getRedirectFormOptionsHtml($auth->getLoginRedirectFormOptions())); } } parent::indexAction(); }