summaryrefslogtreecommitdiffstats
path: root/application/controllers/AuthController.php
diff options
context:
space:
mode:
authorSimon2011-01-31 10:58:14 +0100
committerSimon2011-01-31 10:58:14 +0100
commit7abf17f09c3c5f493d5d4c8e72500d9204c1cece (patch)
tree59fe124199406c9b925eadb97e760aee515568ef /application/controllers/AuthController.php
parentAuthLogin Formular hinzugefügt (diff)
downloadpbs2-7abf17f09c3c5f493d5d4c8e72500d9204c1cece.tar.gz
pbs2-7abf17f09c3c5f493d5d4c8e72500d9204c1cece.tar.xz
pbs2-7abf17f09c3c5f493d5d4c8e72500d9204c1cece.zip
authController hinzugefügt
Diffstat (limited to 'application/controllers/AuthController.php')
-rw-r--r--application/controllers/AuthController.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/application/controllers/AuthController.php b/application/controllers/AuthController.php
new file mode 100644
index 0000000..fa228ea
--- /dev/null
+++ b/application/controllers/AuthController.php
@@ -0,0 +1,43 @@
+<?php
+
+class AuthController extends Zend_Controller_Action
+{
+
+ public function loginAction()
+ {
+ $db = $this->_getParam('db');
+
+ $loginForm = new Default_Form_Auth_Login($_POST);
+
+ if ($loginForm->isValid()) {
+
+ $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;
+
+ }
+
+
+}
+
+
+