From 4223800a7a62eaa6148d7e96e87593e8913150cf Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 19 Apr 2011 17:25:09 +0200 Subject: Logout in der FBGui eingebaut --- .../modules/fbgui/controllers/AuthController.php | 51 ++++++------ .../modules/fbgui/controllers/IndexController.php | 6 +- .../modules/fbgui/views/scripts/index/index.phtml | 92 +++++++++++++++++++--- 3 files changed, 106 insertions(+), 43 deletions(-) (limited to 'application') diff --git a/application/modules/fbgui/controllers/AuthController.php b/application/modules/fbgui/controllers/AuthController.php index c811b06..936aa61 100644 --- a/application/modules/fbgui/controllers/AuthController.php +++ b/application/modules/fbgui/controllers/AuthController.php @@ -39,35 +39,29 @@ class Fbgui_AuthController extends Zend_Controller_Action $auth = Zend_Auth::getInstance(); - $adapter = new Zend_Auth_Adapter_DbTable( - $this->db, - 'pbs_person', - 'email', - 'password', - 'MD5(CONCAT(?, password_salt))' - ); + $adapter = new Zend_Auth_Adapter_DbTable($this->db, 'pbs_person', 'email', 'password', 'MD5(CONCAT(?, password_salt))'); - $adapter->setIdentity($loginForm->getValue('email')); - $adapter->setCredential($loginForm->getValue('password')); - - $result = $auth->authenticate($adapter); - - // TODO: erweiterte fehlerbeschreibung des Users - - if ($result->isValid()) { - $this->personmapper = new Application_Model_PersonMapper(); - $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true); - $person = new Application_Model_Person($result[0]); - $person->setID($result[0]['personID']); - $date = new DateTime(); - $person->setLogindate($date->getTimestamp()); - $this->personmapper->save($person); - $this->_helper->redirector('selectmembership', 'person'); - return; - } else { - echo "Wrong Email or Password."; - } + $adapter->setIdentity($loginForm->getValue('email')); + $adapter->setCredential($loginForm->getValue('password')); + + $result = $auth->authenticate($adapter); + + // TODO: erweiterte fehlerbeschreibung des Users + + if ($result->isValid()) { + $this->personmapper = new Application_Model_PersonMapper(); + $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true); + $person = new Application_Model_Person($result[0]); + $person->setID($result[0]['personID']); + $date = new DateTime(); + $person->setLogindate($date->getTimestamp()); + $this->personmapper->save($person); + $this->_helper->redirector('selectmembership', 'person'); + return; + } else { + echo "Wrong Email or Password."; + } } } $this->view->loginForm = $loginForm; @@ -81,7 +75,8 @@ class Fbgui_AuthController extends Zend_Controller_Action $auth->clearIdentity(); Zend_Session::namespaceUnset('userIDs'); Zend_Session::forgetMe(); - $this->_helper->redirector('login', 'auth'); + $this->_redirect('/fbgui/index'); +# $this->_helper->redirector('fbgui', 'index'); return; } } diff --git a/application/modules/fbgui/controllers/IndexController.php b/application/modules/fbgui/controllers/IndexController.php index 26f12fb..ab146d3 100644 --- a/application/modules/fbgui/controllers/IndexController.php +++ b/application/modules/fbgui/controllers/IndexController.php @@ -135,9 +135,9 @@ class Fbgui_IndexController extends Zend_Controller_Action // 'Your alphasessionID is '.$session->getAlphasessionID(), // 'Your client is '.$session->getClientID(), // 'there is no bootmenu for you'); - - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify("There is no BootMenu to show. Please log in to get your BootMenu.
Click here to login",'error'); + $this->view->nobootmenu = true; + #$pbsNotifier = new Pbs_Notifier(); + #$this->view->notification = $pbsNotifier->notify("There is no BootMenu to show. Please log in to get your BootMenu.
Click here to login",'error'); } } diff --git a/application/modules/fbgui/views/scripts/index/index.phtml b/application/modules/fbgui/views/scripts/index/index.phtml index a141add..2454d45 100644 --- a/application/modules/fbgui/views/scripts/index/index.phtml +++ b/application/modules/fbgui/views/scripts/index/index.phtml @@ -1,12 +1,82 @@ notification != ''){echo $this->notification;} ?> -loginmenu):?> -
-
Login
- This is not your Bootmenu. Select this to get your own Bootmenu. - -
+ +nobootmenu === true):?> +
+
Login
+ There is no BootMenu to show. Please login to get your BootMenu. + +
+ + + +
entries)):?> + loginmenu):?> +
+
Login
+ This is not your Bootmenu. Select this to get your own Bootmenu. + +
+ +
+
Logout
+ Select this to logout and get to the default BootMenu. + +
+