diff options
| author | Björn Geiger | 2011-01-31 14:44:39 +0100 |
|---|---|---|
| committer | Björn Geiger | 2011-01-31 14:44:39 +0100 |
| commit | b8d385ae2f1b792c7d111ebf3fb9020fd01b7d73 (patch) | |
| tree | 3c9cb9ed9ac7cc2a5d7abffdda9071eed02dd193 /application/controllers/AuthController.php | |
| parent | Fehler in SQL korrigiert (diff) | |
| parent | Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff) | |
| download | pbs2-b8d385ae2f1b792c7d111ebf3fb9020fd01b7d73.tar.gz pbs2-b8d385ae2f1b792c7d111ebf3fb9020fd01b7d73.tar.xz pbs2-b8d385ae2f1b792c7d111ebf3fb9020fd01b7d73.zip | |
Merge branch 'master' of git.openslx.org:lsfks/master-teamprojekt/pbs2
Diffstat (limited to 'application/controllers/AuthController.php')
| -rw-r--r-- | application/controllers/AuthController.php | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/application/controllers/AuthController.php b/application/controllers/AuthController.php index c054437..070c2e8 100644 --- a/application/controllers/AuthController.php +++ b/application/controllers/AuthController.php @@ -2,45 +2,44 @@ class AuthController extends Zend_Controller_Action { - public function loginAction() { - $db = $this->_getParam('pbs_person'); + $db = Zend_Db_Table::getDefaultAdapter(); + if (!isset($_POST["login"])){ - $loginForm = new Application_Form_AuthLogin(); + $loginForm = new Application_Form_AuthLogin(); } else { + $loginForm = new Application_Form_AuthLogin($_POST); + + if ($loginForm->isValid($_POST)) { + $adapter = new Zend_Auth_Adapter_DbTable( + $db, + 'pbs_person', + 'email', + 'password', + 'MD5(CONCAT(?, password_salt))' + ); + + $adapter->setIdentity($loginForm->getValue('email')); + $adapter->setCredential($loginForm->getValue('password')); + + $result = $adapter->authenticate(); + + if ($result->isValid()) { + //$this->_helper->FlashMessenger('Erfolgreich angemeldet'); + $this->_userNamespace->username = 'testt'; + + Zend_Debug::dump($_SESSION, $label="_SESSION nach Login: ", $echo=true); + Zend_Debug::dump($this->_userNamespace, $label="userNamespace: ", $echo=true); + $this->view->loginStatus = "Eingeloggt als " . $this->_userNamespace->username; + #$this->_redirect('/'); + return; + } else { + //$this->_helper->FlashMessenger('E-Mail oder Passwort falsch'); + } + } + } - $loginForm = new Application_Form_AuthLogin($_POST); - - if ($loginForm->isValid($_POST)) { - - $adapter = new Zend_Auth_Adapter_DbTable( - $db, - 'users', - 'username', - 'password', - 'MD5(CONCAT(?, password_salt))' - ); - - $adapter->setIdentity($loginForm->getValue('email')); - $adapter->setCredential($loginForm->getValue('password')); - - $result = $auth->authenticate($adapter); - - if ($result->isValid()) { - $this->_helper->FlashMessenger('Erfolgreich angemeldet'); - $this->redirect('/'); - return; - } - - } - } $this->view->loginForm = $loginForm; - } - - } - - - |
