summaryrefslogtreecommitdiffstats
path: root/application/controllers/AuthController.php
diff options
context:
space:
mode:
authorSimon2011-03-08 20:33:51 +0100
committerSimon2011-03-08 20:33:51 +0100
commitc8bbb9cae7b60ed988cbbf93f9e5cdbfae798ce2 (patch)
tree056bc62afec74dadd52677e8a231f5a2c579a8b5 /application/controllers/AuthController.php
parentMerge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff)
downloadpbs2-c8bbb9cae7b60ed988cbbf93f9e5cdbfae798ce2.tar.gz
pbs2-c8bbb9cae7b60ed988cbbf93f9e5cdbfae798ce2.tar.xz
pbs2-c8bbb9cae7b60ed988cbbf93f9e5cdbfae798ce2.zip
ansichten vereinheitlicht & Auth gefixxt & user test//test angelegt
Diffstat (limited to 'application/controllers/AuthController.php')
-rw-r--r--application/controllers/AuthController.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/application/controllers/AuthController.php b/application/controllers/AuthController.php
index c43e5a9..8ccb25c 100644
--- a/application/controllers/AuthController.php
+++ b/application/controllers/AuthController.php
@@ -2,10 +2,10 @@
class AuthController extends Zend_Controller_Action
{
-
+ private $db = null;
public function init()
{
- $db = Zend_Db_Table::getDefaultAdapter();
+ $this->db = Zend_Db_Table::getDefaultAdapter();
}
public function indexAction()
@@ -15,6 +15,9 @@ class AuthController extends Zend_Controller_Action
public function loginAction()
{
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ print_a('bereits angemeldet');
+ }
if (!isset($_POST["login"])){
$loginForm = new Application_Form_AuthLogin();
} else {
@@ -25,7 +28,7 @@ class AuthController extends Zend_Controller_Action
$auth = Zend_Auth::getInstance();
$adapter = new Zend_Auth_Adapter_DbTable(
- $db,
+ $this->db,
'pbs_person',
'email',
'password',
@@ -41,7 +44,7 @@ class AuthController extends Zend_Controller_Action
// TODO: erweiterte fehlerbeschreibung des Users
if ($result->isValid()) {
- $this->_redirect('/');
+ $this->_redirect('/auth/login');
return;
} else {
echo "Falsche Email oder Passwort";
@@ -54,6 +57,9 @@ class AuthController extends Zend_Controller_Action
public function registerAction()
{
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ print_a('bereits angemeldet');
+ }
if (!isset($_POST["register"])){
$registerForm = new Application_Form_AuthRegister();
} else {
@@ -68,7 +74,7 @@ class AuthController extends Zend_Controller_Action
$person->setRegisterdate($date->getTimestamp());
$person->setPasswordSalt(MD5($date->getTimestamp()));
$person->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
-
+ print_a($person);
try {
$personmapper->save($person);
}catch(Zend_Exception $e)
@@ -80,6 +86,7 @@ class AuthController extends Zend_Controller_Action
}
echo "Erfolgreich registriert. <br/>";
echo "Weiter zum Login: <a href=\""."/auth/login"."\">Login</a>";
+ $this->_redirect('/auth/login');
return;
}
}