summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
authormentos2011-01-31 15:15:01 +0100
committermentos2011-01-31 15:15:01 +0100
commit7f58139b45f342843d7d7e9d0a2d1dfda6b6eff3 (patch)
tree7d1f45cbf759c09079fff7b40716c129965bff96 /application/controllers
parentPersonen registrierung (diff)
parentMerge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff)
downloadpbs2-7f58139b45f342843d7d7e9d0a2d1dfda6b6eff3.tar.gz
pbs2-7f58139b45f342843d7d7e9d0a2d1dfda6b6eff3.tar.xz
pbs2-7f58139b45f342843d7d7e9d0a2d1dfda6b6eff3.zip
Person Controller
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/AuthController.php24
-rw-r--r--application/controllers/PersonController.php18
2 files changed, 20 insertions, 22 deletions
diff --git a/application/controllers/AuthController.php b/application/controllers/AuthController.php
index 070c2e8..cc0bca2 100644
--- a/application/controllers/AuthController.php
+++ b/application/controllers/AuthController.php
@@ -12,6 +12,9 @@ class AuthController extends Zend_Controller_Action
$loginForm = new Application_Form_AuthLogin($_POST);
if ($loginForm->isValid($_POST)) {
+
+ $auth = Zend_Auth::getInstance();
+
$adapter = new Zend_Auth_Adapter_DbTable(
$db,
'pbs_person',
@@ -19,20 +22,19 @@ class AuthController extends Zend_Controller_Action
'password',
'MD5(CONCAT(?, password_salt))'
);
-
+
+
$adapter->setIdentity($loginForm->getValue('email'));
$adapter->setCredential($loginForm->getValue('password'));
-
- $result = $adapter->authenticate();
-
+
+ $result = $auth->authenticate($adapter);
+
+ // TODO: erweiterte fehlerbeschreibung des Users
+ // siehe http://framework.zend.com/manual/en/zend.auth.introduction.html
+
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('/');
+ #$this->_helper->FlashMessenger('Erfolgreich angemeldet');
+ $this->_redirect('/');
return;
} else {
//$this->_helper->FlashMessenger('E-Mail oder Passwort falsch');
diff --git a/application/controllers/PersonController.php b/application/controllers/PersonController.php
index 05177c3..65a4cca 100644
--- a/application/controllers/PersonController.php
+++ b/application/controllers/PersonController.php
@@ -3,23 +3,19 @@
class PersonController extends Zend_Controller_Action
{
- public function init()
+ public function preDispatch()
{
+ if (!Zend_Auth::getInstance()->hasIdentity()) {
+ // TODO: quick hack fixxen
+ $this->_redirect('/Auth/login');
+ }
}
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
+ echo 'case2';
+ // action body
}
public function registerAction()