summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Geiger2011-04-11 14:37:44 +0200
committerBjörn Geiger2011-04-11 14:37:44 +0200
commitabedb634fe938e85f68d9be5223c97e392e047cc (patch)
tree9a107776f427eff876598fe9aa1fd0cc2265278a
parentverschiedene Layouts korrigiert (diff)
downloadpbs2-abedb634fe938e85f68d9be5223c97e392e047cc.tar.gz
pbs2-abedb634fe938e85f68d9be5223c97e392e047cc.tar.xz
pbs2-abedb634fe938e85f68d9be5223c97e392e047cc.zip
Bessere Fehlerbeschreibung bei Registrierung
-rw-r--r--application/modules/user/controllers/AuthController.php27
-rw-r--r--application/modules/user/views/scripts/auth/login.phtml1
-rw-r--r--application/modules/user/views/scripts/auth/register.phtml3
3 files changed, 16 insertions, 15 deletions
diff --git a/application/modules/user/controllers/AuthController.php b/application/modules/user/controllers/AuthController.php
index 8160104..bb16e94 100644
--- a/application/modules/user/controllers/AuthController.php
+++ b/application/modules/user/controllers/AuthController.php
@@ -45,8 +45,6 @@ class User_AuthController extends Zend_Controller_Action
$result = $auth->authenticate($adapter);
- // TODO: erweiterte fehlerbeschreibung des Users
-
if ($result->isValid()) {
$this->personmapper = new Application_Model_PersonMapper();
$result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
@@ -58,7 +56,8 @@ class User_AuthController extends Zend_Controller_Action
$this->_helper->redirector('selectmembership', 'person');
return;
} else {
- echo "Wrong Email or Password.";
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Wrong Email or Password', 'error');
}
}
}
@@ -80,34 +79,34 @@ class User_AuthController extends Zend_Controller_Action
public function registerAction()
{
if (Zend_Auth::getInstance()->hasIdentity()) {
- print_a('Already logged in.');
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Already logged in.', 'error');
} else {
if (!isset($_POST["register"])){
$registerForm = new user_Form_Register();
} else {
- $registerForm = new user_Form_Register($_POST);
-
+ foreach($_POST as $k => $v) {
+ if($v != '') {
+ $data[$k] = $v;
+ }
+ }
+ $registerForm = new user_Form_Register($data);
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) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- echo "Email Address already existing..";
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Email already registered', 'error');
+ $this->view->registerForm = $registerForm;
return;
}
- echo "Successfully registered. <br/>";
- echo "Continue to Login: <a href=\""."/dev/auth/login"."\">Login</a>";
$this->_helper->redirector('login', 'auth');
return;
}
diff --git a/application/modules/user/views/scripts/auth/login.phtml b/application/modules/user/views/scripts/auth/login.phtml
index 899c6e7..cc2a3ef 100644
--- a/application/modules/user/views/scripts/auth/login.phtml
+++ b/application/modules/user/views/scripts/auth/login.phtml
@@ -1,6 +1,7 @@
<h1>Login</h1>
<?php
$this->loginForm->setAction($this->url());
+echo $this->notification;
echo $this->loginForm;
?>
<div><button onclick="location.href='/user/auth/recoverpassword'">Recover Password</button></div> \ No newline at end of file
diff --git a/application/modules/user/views/scripts/auth/register.phtml b/application/modules/user/views/scripts/auth/register.phtml
index 6217e06..eb59c68 100644
--- a/application/modules/user/views/scripts/auth/register.phtml
+++ b/application/modules/user/views/scripts/auth/register.phtml
@@ -1,5 +1,6 @@
<h1>New Account</h1>
<?php
+echo $this->notification;
$this->registerForm->setAction($this->url());
echo $this->registerForm;
-?> \ No newline at end of file
+?>