From b5cbdd6b400aa1ec77c9846e9cc8d4257f437e3c Mon Sep 17 00:00:00 2001
From: Simon
Date: Mon, 14 Mar 2011 16:09:03 +0100
Subject: Application in 3 Modules gesplittet, Dev = unsere
entwicklungsumgebung, user = die weboberfläche fr anwender mit acl etc, fbgui
= für die fbgui truppe - links in dev müssen noch angepasst werden
---
application/controllers/AuthController.php | 169 -----------------------------
1 file changed, 169 deletions(-)
delete mode 100644 application/controllers/AuthController.php
(limited to 'application/controllers/AuthController.php')
diff --git a/application/controllers/AuthController.php b/application/controllers/AuthController.php
deleted file mode 100644
index 097417b..0000000
--- a/application/controllers/AuthController.php
+++ /dev/null
@@ -1,169 +0,0 @@
-db = Zend_Db_Table::getDefaultAdapter();
- $this->personmapper = new Application_Model_PersonMapper();
- }
-
- public function indexAction()
- {
- $this->_helper->redirector('login', 'auth');
- }
-
- public function loginAction()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- print_a('Already logged in.');
- } else {
- if (!isset($_POST["login"])){
- $loginForm = new Application_Form_AuthLogin();
- } else {
- $loginForm = new Application_Form_AuthLogin($_POST);
-
- if ($loginForm->isValid($_POST)) {
-
- $auth = Zend_Auth::getInstance();
-
- $adapter = new Zend_Auth_Adapter_DbTable(
- $this->db,
- 'pbs_person',
- 'email',
- 'password',
- 'MD5(CONCAT(?, password_salt))'
- );
-
-
- $adapter->setIdentity($loginForm->getValue('email'));
- $adapter->setCredential($loginForm->getValue('password'));
-
- $result = $auth->authenticate($adapter);
-
- // TODO: erweiterte fehlerbeschreibung des Users
-
- if ($result->isValid()) {
- $this->personmapper = new Application_Model_PersonMapper();
- $result = $this->personmapper->findBy('email', Zend_Auth::getInstance()->getIdentity());
- $person = new Application_Model_Person($result[0]);
- $person->setID($result[0]['personID']);
- $date = new DateTime();
- $person->setLogindate($date->getTimestamp());
- $this->personmapper->save($person);
- $this->_redirect('/');
- return;
- } else {
- echo "Wrong Email or Password.";
- }
- }
- }
-
- $this->view->loginForm = $loginForm;
- }
- }
-
- public function registerAction()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- print_a('Already logged in.');
- } else {
- if (!isset($_POST["register"])){
- $registerForm = new Application_Form_AuthRegister();
- } else {
- $registerForm = new Application_Form_AuthRegister($_POST);
-
- if ($registerForm->isValid($_POST)) {
-
- $person = new Application_Model_Person($_POST);
- $this->personmapper = new Application_Model_PersonMapper();
-
- $date = new DateTime();
- $person->setRegisterdate($date->getTimestamp());
- $person->setPasswordSalt(MD5($date->getTimestamp()));
- $person->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
- print_a($person);
- try {
- $this->personmapper->save($person);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "
";
- echo "Message: " . $e->getMessage() . "
";
- echo "Email Address already existing..";
- return;
- }
- echo "Successfully registered.
";
- echo "Continue to Login: Login";
- $this->_helper->redirector('login', 'auth');
- return;
- }
- }
-
- $this->view->registerForm = $registerForm;
- }
- }
-
- public function logoutAction()
- {
- $auth = Zend_Auth::getInstance();
- $auth->clearIdentity();
- $this->_helper->redirector('login', 'auth');
- }
-
- public function recoverpasswordAction()
- {
- if (!isset($_POST["recoverPassword"])){
- $recoverPasswordForm = new Application_Form_AuthRecoverPassword();
- } else {
- $recoverPasswordForm = new Application_Form_AuthRecoverPassword($_POST);
- # Wiederherstellung funktioniert noch nicht!!!
- /*if ($recoverPasswordForm->isValid($_POST)) {
- $recoverPasswordForm->getView()->url();
- $person = new Application_Model_Person($_POST);
- $this->personmapper = new Application_Model_PersonMapper();
-
- $result = $this->personmapper->findBy('email', $_POST['email']);
- $email = $result[0]['email'];
- $name = $result[0]['firstname'] . ' ' . $result[0]['name'];
- $url = $this->getRequest()->getScheme() . '://' . $this->getRequest()->getHttpHost() . $this->view->url();
- $recoverid = $this->random(100);
- $mailbody = 'Um das Passwort zu ändern klicken Sie auf folgenden Link
Passwort ändern';
- $mail = new Zend_Mail();
- $mail->setBodyHtml($mailbody, 'utf8');
- $mail->getBodyHtml()->getContent();
- $mail->setFrom('admin@local', 'Admin');
- $mail->addTo($email, $name);
- $mail->setSubject('Password Wiederherstellung Preboot Server');
- $mail->send();
- }
- */
- }
-
- $this->view->recoverPasswordForm = $recoverPasswordForm;
- }
-
- public function deleteAction()
- {
- $result = $this->personmapper->findBy('email', Zend_Auth::getInstance()->getIdentity());
- $person = $result[0];
- $personID = $person["personID"];
- if (isset($personID)){
- $this->personmapper = new Application_Model_PersonMapper();
- $person = $this->personmapper->find($personID);
- try {
- $this->personmapper->delete($person);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "
";
- echo "Message: " . $e->getMessage() . "
";
- return;
- }
- $auth = Zend_Auth::getInstance();
- $auth->clearIdentity();
- $this->_helper->redirector('login', 'auth');
- }
- }
-}
\ No newline at end of file
--
cgit v1.2.3-55-g7522