/** * Erstellt einen neuen Account der an eine Session gebunden ist * @return array */ public function createAccount() { $logicAccount = new DragonX_Account_Logic_Account(); $logicSession = new DragonX_Account_Logic_Session(); $sessionhash = $logicSession->loginAccount($logicAccount->createAccount()); return array('sessionhash' => $sessionhash); }
/** * Setzt alle Daten des Layouts aus den Einstellungsdateien * @throw Zend_Controller_Dispatcher_Exception */ public function preDispatch() { parent::preDispatch(); $modulename = $this->getRequest()->getModuleName(); $this->view->modulename = $modulename; $controllername = $this->getRequest()->getControllerName(); $this->view->controllername = $controllername; $actionname = $this->getRequest()->getActionName(); $recordAccount = null; if (Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Account') && Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Emailaddress')) { $sessionNamespace = new Zend_Session_Namespace(); if (isset($sessionNamespace->sessionhash)) { $logicSession = new DragonX_Account_Logic_Session(); try { $recordAccount = $logicSession->getAccount($sessionNamespace->sessionhash); $this->view->sessionhash = $sessionNamespace->sessionhash; Zend_Registry::set('recordAccount', $recordAccount); $this->view->recordAccount = $recordAccount; $logicEmailaddress = new DragonX_Emailaddress_Logic_Emailaddress(); $this->view->recordEmailaddress = $logicEmailaddress->getEmailaddress($recordAccount); $logicDeletion = new DragonX_Account_Logic_Deletion(); $recordDeletion = $logicDeletion->getDeletion($recordAccount); if (isset($recordDeletion)) { $this->view->recordDeletion = $recordDeletion; } } catch (Exception $exception) { $sessionNamespace->unsetAll(); if ($modulename == 'homepage' && $controllername == 'account' && $actionname == 'logout') { $this->_helper->FlashMessenger('<div class="alert alert-success">Abmeldung erfolgreich</div>'); } else { $this->_helper->FlashMessenger('<div class="alert alert-error">Die Session ist abgelaufen. Profil muss neu angemeldet werden</div>'); } } } } $this->view->configApplication = new Dragon_Application_Config('dragon/application/application'); $modulenamearray = explode('_', $modulename); $controllerarea = end($modulenamearray); $this->view->controllerarea = $controllerarea; switch ($controllerarea) { case 'homepage': $this->view->configNavigation = new Dragon_Application_Config('dragonx/homepage/navigation/homepage'); break; case 'administration': if (!Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Account') || !Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Emailaddress')) { throw new Dragon_Application_Exception_User('incorrect controller', array('controllername' => $controllername)); } if (!isset($recordAccount)) { $this->_helper->FlashMessenger('<div class="alert alert-error">Die Session wurde noch nicht gestartet oder ist abgelaufen. Profil muss angemeldet werden</div>'); $this->_redirect('account/showlogin?' . http_build_query(array('redirect' => $modulename . '/' . $controllername . '/' . $actionname))); } if (Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Acl')) { $logicAcl = new DragonX_Acl_Logic_Acl(); $this->view->resources = $logicAcl->getResources($recordAccount); } $this->view->configNavigation = new Dragon_Application_Config('dragonx/homepage/navigation/administration'); break; } }
/** * Meldet den Account mit der E-Mail Adresse und dem Passwort an * @param string $emailaddress * @param string $password * @throws InvalidArgumentException * @return array */ public function loginAccount($emailaddress, $password) { $logicEmailaddress = new DragonX_Emailaddress_Logic_Emailaddress(); $logicSession = new DragonX_Account_Logic_Session(); list($recordAccount) = $logicEmailaddress->getAccount($emailaddress, $password); $sessionhash = $logicSession->loginAccount($recordAccount); return array('sessionhash' => $sessionhash); }
/** * Gibt den Account mit den übergebenen Anmeldedaten des Gerätes zurück * @param string $platform * @param object $credentials * @return array */ public function loginAccount($platform = 'test', array $credentials = array('a' => '', 'b' => '', 'c' => '')) { $logicDevice = new DragonX_Device_Logic_Device(); $logicSession = new DragonX_Account_Logic_Session(); list($recordAccount) = $logicDevice->getAccount($platform, $credentials); $sessionhash = $logicSession->loginAccount($recordAccount); return array('sessionhash' => $sessionhash); }
/** * Prüft bei jedem Request die Authentifizierung * @param Dragon_Json_Server_Request_Http $request */ public function preDispatch(Dragon_Json_Server_Request_Http $request) { list($classname, $methodname) = $request->parseMethod(); if (!$this->_authenticateRequired($classname, $methodname)) { return; } $params = $request->getRequiredParams(array('sessionhash')); $logicSession = new DragonX_Account_Logic_Session(); $recordAccount = $logicSession->getAccount($params['sessionhash']); $logicAccount = new DragonX_Account_Logic_Account(); $logicAccount->requestAccount($recordAccount); Zend_Registry::get('Dragon_Plugin_Registry')->invoke('DragonX_Account_Plugin_LoadAccount_Interface', array($recordAccount)); Zend_Registry::set('recordAccount', $recordAccount); }
/** * Setzt das Passwort für die Passwort vergessen Anfrage zurück */ public function resetAction() { try { $params = $this->getRequiredParams(array('credentialhash', 'newpassword')); $logicCredential = new DragonX_Emailaddress_Logic_Credential(); $recordAccount = $logicCredential->reset($params['credentialhash'], $params['newpassword']); } catch (Exception $exception) { $this->_helper->FlashMessenger('<div class="alert alert-error">Resetlink nicht korrekt</div>'); $this->_redirect('credential/showrequest'); } $logicSession = new DragonX_Account_Logic_Session(); $sessionNamespace = new Zend_Session_Namespace(); $sessionNamespace->sessionhash = $logicSession->loginAccount($recordAccount); $this->_helper->FlashMessenger('<div class="alert alert-success">Zurücksetzen des Passworts erfolgreich</div>'); $this->_redirect('administration'); }
/** * Meldet den derzeit eingeloggten Account ab */ public function logoutAction() { $sessionNamespace = new Zend_Session_Namespace(); if (!isset($sessionNamespace->sessionhash)) { $this->_redirect(''); } $logicSession = new DragonX_Account_Logic_Session(); $logicSession->logoutAccount($sessionNamespace->sessionhash); $sessionNamespace->unsetAll(); $this->_helper->FlashMessenger('<div class="alert alert-success">Abmeldung erfolgreich</div>'); $this->_redirect(''); }
/** * Meldet den Account ab und entfernt die Session * @param string $sessionhash */ public function logoutAccount($sessionhash) { $logicSession = new DragonX_Account_Logic_Session(); $logicSession->logoutAccount($sessionhash); }