From 81a7f3d0ba4eb559a958666ca5111e5bee875bfb Mon Sep 17 00:00:00 2001 From: "Duck (Jakob Munih)" Date: Thu, 1 Oct 2009 18:12:16 +0200 Subject: [PATCH] Horde_Auth::authenticateFailure --- folks/account/approve.php | 18 ++++++------------ folks/account/renew.php | 20 +++++++------------- folks/account/resetpassword.php | 12 ++++-------- folks/account/signup.php | 9 +++------ folks/account/username.php | 3 +-- folks/edit/password.php | 3 +-- folks/templates/user/authenticated.php | 2 +- 7 files changed, 23 insertions(+), 44 deletions(-) diff --git a/folks/account/approve.php b/folks/account/approve.php index 423af9597..81e40742c 100644 --- a/folks/account/approve.php +++ b/folks/account/approve.php @@ -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'); diff --git a/folks/account/renew.php b/folks/account/renew.php index d1e0663a5..a8d3390e9 100644 --- a/folks/account/renew.php +++ b/folks/account/renew.php @@ -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'); diff --git a/folks/account/resetpassword.php b/folks/account/resetpassword.php index 88ef8558a..29574937c 100644 --- a/folks/account/resetpassword.php +++ b/folks/account/resetpassword.php @@ -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. */ diff --git a/folks/account/signup.php b/folks/account/signup.php index 9a9303ae8..3e35663b8 100644 --- a/folks/account/signup.php +++ b/folks/account/signup.php @@ -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'); } } diff --git a/folks/account/username.php b/folks/account/username.php index b9c273243..72c269b5b 100644 --- a/folks/account/username.php +++ b/folks/account/username.php @@ -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'); } } diff --git a/folks/edit/password.php b/folks/edit/password.php index f29ae36d3..e9b66003d 100644 --- a/folks/edit/password.php +++ b/folks/edit/password.php @@ -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"); diff --git a/folks/templates/user/authenticated.php b/folks/templates/user/authenticated.php index 29f632eef..319ff4683 100644 --- a/folks/templates/user/authenticated.php +++ b/folks/templates/user/authenticated.php @@ -5,7 +5,7 @@ ' . _("Click here to login.") - . ' ' . _("Click here to login.") . '' + . ' ' . _("Click here to login.") . '' . ''; ?> -- 2.11.0