From c8bbb9cae7b60ed988cbbf93f9e5cdbfae798ce2 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 8 Mar 2011 20:33:51 +0100 Subject: ansichten vereinheitlicht & Auth gefixxt & user test//test angelegt --- application/controllers/AuthController.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'application/controllers/AuthController.php') diff --git a/application/controllers/AuthController.php b/application/controllers/AuthController.php index c43e5a9..8ccb25c 100644 --- a/application/controllers/AuthController.php +++ b/application/controllers/AuthController.php @@ -2,10 +2,10 @@ class AuthController extends Zend_Controller_Action { - + private $db = null; public function init() { - $db = Zend_Db_Table::getDefaultAdapter(); + $this->db = Zend_Db_Table::getDefaultAdapter(); } public function indexAction() @@ -15,6 +15,9 @@ class AuthController extends Zend_Controller_Action public function loginAction() { + if (Zend_Auth::getInstance()->hasIdentity()) { + print_a('bereits angemeldet'); + } if (!isset($_POST["login"])){ $loginForm = new Application_Form_AuthLogin(); } else { @@ -25,7 +28,7 @@ class AuthController extends Zend_Controller_Action $auth = Zend_Auth::getInstance(); $adapter = new Zend_Auth_Adapter_DbTable( - $db, + $this->db, 'pbs_person', 'email', 'password', @@ -41,7 +44,7 @@ class AuthController extends Zend_Controller_Action // TODO: erweiterte fehlerbeschreibung des Users if ($result->isValid()) { - $this->_redirect('/'); + $this->_redirect('/auth/login'); return; } else { echo "Falsche Email oder Passwort"; @@ -54,6 +57,9 @@ class AuthController extends Zend_Controller_Action public function registerAction() { + if (Zend_Auth::getInstance()->hasIdentity()) { + print_a('bereits angemeldet'); + } if (!isset($_POST["register"])){ $registerForm = new Application_Form_AuthRegister(); } else { @@ -68,7 +74,7 @@ class AuthController extends Zend_Controller_Action $person->setRegisterdate($date->getTimestamp()); $person->setPasswordSalt(MD5($date->getTimestamp())); $person->setPassword(MD5($person->getPassword() . $person->getPasswordSalt())); - + print_a($person); try { $personmapper->save($person); }catch(Zend_Exception $e) @@ -80,6 +86,7 @@ class AuthController extends Zend_Controller_Action } echo "Erfolgreich registriert.
"; echo "Weiter zum Login: Login"; + $this->_redirect('/auth/login'); return; } } -- cgit v1.2.3-55-g7522