Horde_Auth::authenticateFailure
authorDuck (Jakob Munih) <duck@obala.net>
Thu, 1 Oct 2009 16:12:16 +0000 (18:12 +0200)
committerDuck (Jakob Munih) <duck@obala.net>
Thu, 1 Oct 2009 16:12:16 +0000 (18:12 +0200)
folks/account/approve.php
folks/account/renew.php
folks/account/resetpassword.php
folks/account/signup.php
folks/account/username.php
folks/edit/password.php
folks/templates/user/authenticated.php

index 423af95..81e4074 100644 (file)
@@ -18,39 +18,34 @@ $title = _("Confirm email");
 $code = Horde_Util::getGet('code');
 if (empty($code)) {
     $notification->push(_("You must supply a confirmation code."));
-    header('Location: ' . Horde_Auth::getLoginScreen('folks', Horde::applicationUrl('edit/edit.php')));
-    exit;
+    Horde_Auth::authenticateFailure('folks');
 }
 
 // Get supplied username
 $user = Horde_Util::getGet('user');
 if (empty($code)) {
     $notification->push(_("You must supply a username."));
-    header('Location: ' . Horde_Auth::getLoginScreen('folks', Horde::applicationUrl('edit/edit.php')));
-    exit;
+    Horde_Auth::authenticateFailure('folks');
 }
 
 // Get user profile
 $profile = $folks_driver->getProfile($user);
 if ($profile instanceof PEAR_Error) {
     $notification->push($profile);
-    header('Location: ' . Horde_Auth::getLoginScreen('folks', Horde::applicationUrl('edit/edit.php')));
-    exit;
+    Horde_Auth::authenticateFailure('folks');
 }
 
 // This pages is only to activate users
 if ($profile['user_status'] != 'inactive') {
     $notification->push(_("User \"%s\" was already activated."));
-    header('Location: ' . Horde_Auth::getLoginScreen('folks', Horde::applicationUrl('edit/edit.php')));
-    exit;
+    Horde_Auth::authenticateFailure('folks');
 }
 
 // Get internal confirmation code
 $internal_code = $folks_driver->getConfirmationCode($user, 'activate');
 if ($internal_code instanceof PEAR_Error) {
     $notification->push($internal_code);
-    header('Location: ' . Horde_Auth::getLoginScreen('folks', Horde::applicationUrl('edit/edit.php')));
-    exit;
+    Horde_Auth::authenticateFailure('folks');
 }
 
 // Check code
@@ -65,5 +60,4 @@ if ($internal_code == $code) {
     $notification->push(_("The code is not right. If you copy and paste the link from your email, please check if you copied the whole string."), 'horde.warning');
 }
 
-header('Location: ' . Horde_Auth::getLoginScreen('folks', Horde::applicationUrl('edit/edit.php')));
-exit;
+Horde_Auth::authenticateFailure('folks');
index d1e0663..a8d3390 100644 (file)
@@ -18,39 +18,34 @@ $title = _("Renew account");
 $code = Horde_Util::getGet('code');
 if (empty($code)) {
     $notification->push(_("You must supply a confirmation code."));
-    header('Location: ' . Horde_Auth::getLoginScreen('folks', Horde::applicationUrl('edit/edit.php')));
-    exit;
+    Horde_Auth::authenticateFailure('folks');
 }
 
 // Get supplied username
 $user = Horde_Util::getGet('user');
 if (empty($code)) {
     $notification->push(_("You must supply a username."));
-    header('Location: ' . Horde_Auth::getLoginScreen('folks', Horde::applicationUrl('edit/edit.php')));
-    exit;
+    Horde_Auth::authenticateFailure('folks');
 }
 
 // Get user profile
 $profile = $folks_driver->getProfile($user);
 if ($profile instanceof PEAR_Error) {
     $notification->push($profile);
-    header('Location: ' . Horde_Auth::getLoginScreen('folks', Horde::applicationUrl('edit/edit.php')));
-    exit;
+    Horde_Auth::authenticateFailure('folks');
 }
 
 // This pages is only to activate users
 if ($profile['user_status'] != 'deleted') {
     $notification->push(_("User \"%s\" is not market to be in the removal process."));
-    header('Location: ' . Horde_Auth::getLoginScreen('folks', Horde::applicationUrl('edit/edit.php')));
-    exit;
+    Horde_Auth::authenticateFailure('folks');
 }
-        
+
 // Get internal confirmation code
 $internal_code = $folks_driver->getConfirmationCode($user, 'renew');
 if ($internal_code instanceof PEAR_Error) {
     $notification->push($internal_code);
-    header('Location: ' . Horde_Auth::getLoginScreen('folks', Horde::applicationUrl('edit/edit.php')));
-    exit;
+    Horde_Auth::authenticateFailure('folks');
 }
 
 // Check code
@@ -65,5 +60,4 @@ if ($internal_code == $code) {
     $notification->push(_("The code is not right. If you copy and paste the link from your email, please check if you copied the whole string."), 'horde.warning');
 }
 
-header('Location: ' . Horde_Auth::getLoginScreen('folks', Horde::applicationUrl('edit/edit.php')));
-exit;
+Horde_Auth::authenticateFailure('folks');
index 88ef855..2957493 100644 (file)
@@ -38,8 +38,7 @@ if (Horde_Auth::isAuthenticated()) {
 $auth = Horde_Auth::singleton($conf['auth']['driver']);
 if (!$auth->hasCapability('resetpassword')) {
     $notification->push(_("Cannot reset password automatically, contact your administrator."), 'horde.error');
-    header('Location: ' . Horde_Auth::getLoginScreen('', Horde_Util::getFormData('url')));
-    exit;
+    Horde_Auth::authenticateFailure('folks');
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -82,8 +81,7 @@ if ($form->validate()) {
     $email = Folks::getUserEmail($info['username']);
     if ($email instanceof PEAR_Error) {
         $notification->push($email);
-        header('Location: ' . Horde_Auth::getLoginScreen('', $info['url']));
-        exit;
+        Horde_Auth::authenticateFailure('folks');
     }
 
     /* Check the given values with the prefs stored ones. */
@@ -94,8 +92,7 @@ if ($form->validate()) {
         $password = $auth->resetPassword($info['username']);
         if ($password instanceof PEAR_Error) {
             $notification->push($password);
-            header('Location: ' . Horde_Auth::getLoginScreen('', $info['url']));
-            exit;
+            Horde_Auth::authenticateFailure('folks');
         }
 
         $body = sprintf(_("Your new password for %s is: %s. \n\n It was requested by %s on %s"),
@@ -107,8 +104,7 @@ if ($form->validate()) {
         Folks::sendMail($email, _("Your password has been reset"), $body);
 
         $notification->push(sprintf(_("Your password has been reset, check your email (%s) and log in with your new password."), $email), 'horde.success');
-        header('Location: ' . Horde_Auth::getLoginScreen('', $info['url']));
-        exit;
+        Horde_Auth::authenticateFailure('folks');
     } else {
         /* Info submitted does not match what is in prefs, redirect user back
          * to login. */
index 9a9303a..3e35663 100644 (file)
@@ -19,8 +19,7 @@ $auth = Horde_Auth::singleton($conf['auth']['driver']);
 if ($conf['signup']['allow'] !== true ||
     !$auth->hasCapability('add')) {
     $notification->push(_("User Registration has been disabled for this site."), 'horde.error');
-    header('Location: ' . Horde_Auth::getLoginScreen());
-    exit;
+    Horde_Auth::authenticateFailure('folks');
 }
 
 $vars = Horde_Variables::getDefaultVariables();
@@ -28,7 +27,7 @@ $form = new HordeSignupForm($vars);
 if ($form->validate()) {
     $form->getInfo(null, $info);
 
-    $signup = new Auth_Signup();
+    $signup = new Horde_Auth_Signup();
     $success_message = null;
 
     if (!$conf['signup']['approve']) {
@@ -52,9 +51,7 @@ if ($form->validate()) {
         $notification->push(sprintf(_("There was a problem adding \"%s\" to the system: %s"), $info['user_name'], $success->getMessage()), 'horde.error');
     } else {
         $notification->push($success_message, 'horde.success');
-        $url = Horde_Auth::getLoginScreen('', $info['url']);
-        header('Location: ' . $url);
-        exit;
+        Horde_Auth::authenticateFailure('folks');
     }
 }
 
index b9c2732..72c269b 100644 (file)
@@ -41,8 +41,7 @@ if ($form->validate()) {
         Folks::sendMail($info['email'], _("Your username was requested"), $body);
 
         $notification->push(sprintf(_("Your username was sent, check your email (%s)."), $users['user_email']), 'horde.success');
-        header('Location: ' . Horde_Auth::getLoginScreen('', $info['url']));
-        exit;
+        Horde_Auth::authenticateFailure('folks');
     }
 }
 
index f29ae36..e9b6600 100644 (file)
@@ -18,8 +18,7 @@ require_once 'tabs.php';
 $auth = Horde_Auth::singleton($conf['auth']['driver']);
 if (!$auth->hasCapability('resetpassword')) {
     $notification->push(_("Cannot update password, contact your administrator."), 'horde.error');
-    header('Location: ' . Horde_Auth::getLoginScreen('', Horde_Util::getFormData('url')));
-    exit;
+    Horde_Auth::authenticateFailure('folks');
 }
 
 $title = _("Change Your Password");
index 29f632e..319ff46 100644 (file)
@@ -5,7 +5,7 @@
 <?php
 echo '<li><img src="' . $registry->getImageDir('horde') . '/alerts/success.png">'
                 . _("Click here to login.")
-                . ' <a href="' . Horde_Auth::getLoginScreen('letter', Horde_Util::addParameter(Horde::applicationUrl('user.php'), 'user', $user))  . '">' . _("Click here to login.") . '</a>'
+                . ' <a href="' . Hode::getServiceLink('login', 'folks')  . '">' . _("Click here to login.") . '</a>'
                     . '</li>';
 ?>
 </ul>