summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/AuthController.php67
-rw-r--r--application/controllers/PersonController.php26
2 files changed, 59 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;
-
}
-
-
}
-
-
-
diff --git a/application/controllers/PersonController.php b/application/controllers/PersonController.php
new file mode 100644
index 0000000..9a8aea2
--- /dev/null
+++ b/application/controllers/PersonController.php
@@ -0,0 +1,26 @@
+<?php
+
+class PersonController extends Zend_Controller_Action
+{
+
+ public function init()
+ {
+
+ }
+
+ public function indexAction()
+ {
+ if (!Zend_Auth::getInstance()->hasIdentity()) {
+ echo 'case1';
+
+
+ echo "already logged in as: " . Zend_Auth::getInstance()->getIdentity();
+ #$this->_redirect($this->url(array('Auth','login')));
+ }
+ echo 'case2';
+ // action body
+ }
+
+
+}
+