summaryrefslogtreecommitdiffstats
path: root/application/controllers/AuthController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers/AuthController.php')
-rw-r--r--application/controllers/AuthController.php62
1 files changed, 28 insertions, 34 deletions
diff --git a/application/controllers/AuthController.php b/application/controllers/AuthController.php
index c054437..0a2c8c0 100644
--- a/application/controllers/AuthController.php
+++ b/application/controllers/AuthController.php
@@ -2,45 +2,39 @@
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->_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;
-
}
-
-
}
-
-
-