From b1cf2026da1f4a9294f13e851fb9d2f5e8785af0 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 22 Jul 2009 12:32:54 -0600 Subject: [PATCH] Fix setting the message string in the generated URL --- framework/Auth/lib/Horde/Auth.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/framework/Auth/lib/Horde/Auth.php b/framework/Auth/lib/Horde/Auth.php index 11ae5fd3b..8c5b41d20 100644 --- a/framework/Auth/lib/Horde/Auth.php +++ b/framework/Auth/lib/Horde/Auth.php @@ -500,7 +500,13 @@ class Horde_Auth $options['reason'] = self::getAuthError(); } - if ($options['reason'] == self::REASON_LOGOUT) { + if (isset($options['app'])) { + $params['app'] = $options['app']; + } + + if (empty($params['app']) || + ($params['app'] == 'horde') || + ($options['reason'] == self::REASON_LOGOUT)) { $params = array( 'horde_logout_token' => Horde::getRequestToken('horde.logout'), 'nosidebar' => 1 @@ -511,15 +517,11 @@ class Horde_Auth ); } - if (isset($options['app'])) { - $params['app'] = $options['app']; - } - if ($options['reason']) { $params[self::REASON_PARAM] = $options['reason']; if ($options['reason'] == self::REASON_MESSAGE) { $params[self::REASON_MSG_PARAM] = empty($options['msg']) - ? '' + ? self::getAuthError(true) : $options['msg']; } } @@ -885,14 +887,17 @@ class Horde_Auth } /** - * Returns the error type for an invalid authentication or false on error. + * Returns the error type or message for an invalid authentication. + * + * @param boolean $msg If true, returns the message string (if set). * - * @return mixed Error type or false on error. + * @return mixed Error type, error message (if $msg is true) or false + * if entry doesn't exist. */ - static public function getAuthError() + static public function getAuthError($msg = false) { return isset(self::$_reason['type']) - ? self::$_reason['type'] + ? ($msg ? self::$_reason['msg'] : self::$_reason['type']) : false; } -- 2.11.0