try {
$registry->pushApp('babel', array('logintasks' => true));
} catch (Horde_Exception $e) {
- Horde_Auth::authenticateFailure('babel', $e);
+ $registry->authenticateFailure('babel', $e);
}
$conf = &$GLOBALS['conf'];
try {
$registry->pushApp('crumb', array('logintasks' => true));
} catch (Horde_Exception $e) {
- Horde_Auth::authenticateFailure('crumb', $e);
+ $registry->authenticateFailure('crumb', $e);
}
$conf = &$GLOBALS['conf'];
@define('CRUMB_TEMPLATES', $registry->get('templates'));
try {
$registry->pushApp('fima', array('logintasks' => true));
} catch (Horde_Exception $e) {
- Horde_Auth::authenticateFailure('fima', $e);
+ $registry->authenticateFailure('fima', $e);
}
$conf = &$GLOBALS['conf'];
@define('FIMA_TEMPLATES', $registry->get('templates'));
$code = Horde_Util::getGet('code');
if (empty($code)) {
$notification->push(_("You must supply a confirmation code."));
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
// Get supplied username
$user = Horde_Util::getGet('user');
if (empty($code)) {
$notification->push(_("You must supply a username."));
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
// Get user profile
$profile = $folks_driver->getProfile($user);
if ($profile instanceof PEAR_Error) {
$notification->push($profile);
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
// This pages is only to activate users
if ($profile['user_status'] != 'inactive') {
$notification->push(_("User \"%s\" was already activated."));
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
// Get internal confirmation code
$internal_code = $folks_driver->getConfirmationCode($user, 'activate');
if ($internal_code instanceof PEAR_Error) {
$notification->push($internal_code);
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
// Check 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');
}
-Horde_Auth::authenticateFailure('folks');
+$registry->authenticateFailure('folks');
$code = Horde_Util::getGet('code');
if (empty($code)) {
$notification->push(_("You must supply a confirmation code."));
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
// Get supplied username
$user = Horde_Util::getGet('user');
if (empty($code)) {
$notification->push(_("You must supply a username."));
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
// Get user profile
$profile = $folks_driver->getProfile($user);
if ($profile instanceof PEAR_Error) {
$notification->push($profile);
- Horde_Auth::authenticateFailure('folks');
+ $registry->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."));
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
// Get internal confirmation code
$internal_code = $folks_driver->getConfirmationCode($user, 'renew');
if ($internal_code instanceof PEAR_Error) {
$notification->push($internal_code);
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
// Check 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');
}
-Horde_Auth::authenticateFailure('folks');
+$registry->authenticateFailure('folks');
$auth = $injector->getInstance('Horde_Auth')->getOb();
if (!$auth->hasCapability('resetpassword')) {
$notification->push(_("Cannot reset password automatically, contact your administrator."), 'horde.error');
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
$vars = Horde_Variables::getDefaultVariables();
$email = Folks::getUserEmail($info['username']);
if ($email instanceof PEAR_Error) {
$notification->push($email);
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
/* Check the given values with the prefs stored ones. */
$password = $auth->resetPassword($info['username']);
if ($password instanceof PEAR_Error) {
$notification->push($password);
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
$body = sprintf(_("Your new password for %s is: %s. \n\n It was requested by %s on %s"),
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');
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
} else {
/* Info submitted does not match what is in prefs, redirect user back
* to login. */
if ($conf['signup']['allow'] !== true ||
!$auth->hasCapability('add')) {
$notification->push(_("User Registration has been disabled for this site."), 'horde.error');
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
$signup = $injector->getInstance('Horde_Core_Auth_Signup');
if ($signup instanceof PEAR_Error) {
$notification->push($signup, 'horde.error');
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
$vars = Horde_Variables::getDefaultVariables();
$success_message = sprintf(_("Added \"%s\" to the system. You can log in now."), $info['user_name']);
}
$notification->push($success_message, 'horde.success');
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
} catch (Horde_Exception $e) {
$notification->push(sprintf(_("There was a problem adding \"%s\" to the system: %s"), $info['user_name'], $e->getMessage()), 'horde.error');
}
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');
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
}
require_once FOLKS_BASE . '/lib/Friends.php';
if (!$registry->isAuthenticated()) {
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
$user = Horde_Util::getGet('user');
require_once FOLKS_BASE . '/lib/Friends.php';
if (!$registry->isAuthenticated()) {
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
$user = Horde_Util::getGet('user');
$auth = $injector->getInstance('Horde_Auth')->getOb();
if (!$auth->hasCapability('resetpassword')) {
$notification->push(_("Cannot update password, contact your administrator."), 'horde.error');
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
*/
*/
if (!$registry->isAuthenticated()) {
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
$vars = Horde_Variables::getDefaultVariables();
require_once FOLKS_BASE . '/lib/Forms/Activity.php';
if (!$registry->isAuthenticated()) {
- Horde_Auth::authenticateFailure('folks');
+ $registry->authenticateFailure('folks');
}
$title = _("Friends");
try {
$registry->pushApp('folks', array('check_perms' => (Horde_Util::nonInputVar('folks_authentication') != 'none')));
} catch (Horde_Exception $e) {
- Horde_Auth::authenticateFailure('folks', $e);
+ $registry->authenticateFailure('folks', $e);
}
$conf = &$GLOBALS['conf'];
define('FOLKS_TEMPLATES', $registry->get('templates'));
}
/**
- * Handle authentication failures, redirecting to the login page
- * when appropriate.
- *
- * @param string $app The app which failed authentication.
- * @param Horde_Exception $e An exception thrown by
- * Horde_Registry::pushApp().
- *
- * @throws Horde_Exception
- */
- static public function authenticateFailure($app = 'horde', $e = null)
- {
- if (Horde_Cli::runningFromCLI()) {
- $cli = new Horde_Cli();
- $cli->fatal(_("You are not authenticated."));
- }
-
- if (is_null($e)) {
- $params = array();
- } else {
- switch ($e->getCode()) {
- case Horde_Registry::PERMISSION_DENIED:
- $params = array('app' => $app, 'reason' => self::REASON_MESSAGE, 'msg' => $e->getMessage());
- break;
-
- case Horde_Registry::AUTH_FAILURE:
- $params = array('app' => $app);
- break;
-
- default:
- throw $e;
- }
- }
-
- header('Location: ' . self::getLogoutUrl($params));
- exit;
- }
-
- /**
- * Return a URL to the login screen, adding the necessary logout
- * parameters.
- * If no reason/msg is passed in, use the current global authentication
- * error message.
- *
- * @param array $options Additional options:
- * <pre>
- * 'app' - (string) Authenticate to this application
- * DEFAULT: Horde
- * 'msg' - (string) If reason is self::REASON_MESSAGE, the message
- * to display to the user.
- * DEFAULT: None
- * 'params' - (array) Additional params to add to the URL (not allowed:
- * 'app', 'horde_logout_token', 'msg', 'nosidebar', 'reason',
- * 'url').
- * DEFAULT: None
- * 'reason' - (integer) The reason for logout
- * DEFAULT: None
- * </pre>
- *
- * @return string The formatted URL
- */
- static public function getLogoutUrl($options = array())
- {
- if (!isset($options['reason'])) {
- $options['reason'] = self::getAuthError();
- }
-
- if (empty($options['app']) ||
- ($options['app'] == 'horde') ||
- ($options['reason'] == self::REASON_LOGOUT)) {
- $params = array(
- 'horde_logout_token' => Horde::getRequestToken('horde.logout'),
- 'nosidebar' => 1
- );
- } else {
- $params = array(
- 'url' => Horde::selfUrl(true, true, true)
- );
- }
-
- 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'];
- }
- }
-
- return Horde::getServiceLink('login', 'horde')->add($params)->setRaw(true);
- }
-
- /**
* Return whether the authentication backend requested a password change.
*
* @return boolean Whether the backend requested a password change.
->add('return_url', urlencode(self::selfUrl(true, true, true)));
case 'logout':
- return Horde_Auth::getLogoutUrl(array('reason' => Horde_Auth::REASON_LOGOUT))->setRaw(false);
+ return $GLOBALS['registry']->getLogoutUrl(array('reason' => Horde_Auth::REASON_LOGOUT))->setRaw(false);
case 'login':
return self::url($webroot . '/login.php');
throw $e;
}
- Horde_Auth::authenticateFailure($app, $e);
+ $GLOBALS['registry']->authenticateFailure($app, $e);
}
$GLOBALS['registry']->initialApp = $app;
return $auth->transparent();
}
+ /**
+ * Handle authentication failures, redirecting to the login page
+ * when appropriate.
+ *
+ * @param string $app The app which failed authentication.
+ * @param Horde_Exception $e An exception thrown by pushApp().
+ *
+ * @throws Horde_Exception
+ */
+ public function authenticateFailure($app = 'horde', $e = null)
+ {
+ if (Horde_Cli::runningFromCLI()) {
+ $cli = new Horde_Cli();
+ $cli->fatal(_("You are not authenticated."));
+ }
+
+ if (is_null($e)) {
+ $params = array();
+ } else {
+ switch ($e->getCode()) {
+ case self::PERMISSION_DENIED:
+ $params = array('app' => $app, 'reason' => Horde_Auth::REASON_MESSAGE, 'msg' => $e->getMessage());
+ break;
+
+ case self::AUTH_FAILURE:
+ $params = array('app' => $app);
+ break;
+
+ default:
+ throw $e;
+ }
+ }
+
+ header('Location: ' . $this->getLogoutUrl($params));
+ exit;
+ }
+
+ /**
+ * Return a URL to the login screen, adding the necessary logout
+ * parameters.
+ * If no reason/msg is passed in, use the current global authentication
+ * error message.
+ *
+ * @param array $options Additional options:
+ * <pre>
+ * 'app' - (string) Authenticate to this application
+ * DEFAULT: Horde
+ * 'msg' - (string) If reason is Horde_Auth::REASON_MESSAGE, the message
+ * to display to the user.
+ * DEFAULT: None
+ * 'params' - (array) Additional params to add to the URL (not allowed:
+ * 'app', 'horde_logout_token', 'msg', 'nosidebar', 'reason',
+ * 'url').
+ * DEFAULT: None
+ * 'reason' - (integer) The reason for logout
+ * DEFAULT: None
+ * </pre>
+ *
+ * @return string The formatted URL
+ */
+ public function getLogoutUrl(array $options = array())
+ {
+ if (!isset($options['reason'])) {
+ $options['reason'] = Horde_Auth::getAuthError();
+ }
+
+ if (empty($options['app']) ||
+ ($options['app'] == 'horde') ||
+ ($options['reason'] == Horde_Auth::REASON_LOGOUT)) {
+ $params = array(
+ 'horde_logout_token' => Horde::getRequestToken('horde.logout'),
+ 'nosidebar' => 1
+ );
+ } else {
+ $params = array(
+ 'url' => Horde::selfUrl(true, true, true)
+ );
+ }
+
+ if (isset($options['app'])) {
+ $params['app'] = $options['app'];
+ }
+
+ if ($options['reason']) {
+ $params[Horde_Auth::REASON_PARAM] = $options['reason'];
+ if ($options['reason'] == Horde_Auth::REASON_MESSAGE) {
+ $params[Horde_Auth::REASON_MSG_PARAM] = empty($options['msg'])
+ ? Horde_Auth::getAuthError(true)
+ : $options['msg'];
+ }
+ }
+
+ return Horde::getServiceLink('login', 'horde')->add($params)->setRaw(true);
+ }
+
}
{
if (Horde_Util::getFormData('not_agree')) {
Horde_Auth::setAuthError(Horde_Auth::REASON_MESSAGE, _("You did not agree to the Terms of Service agreement, so you were not allowed to login."));
- Horde_Auth::authenticateFailure('horde');
+ $GLOBALS['registry']->authenticateFailure('horde');
}
}
/* Handle session timeouts when they come from an AJAX request. */
if ($e->getCode() == Horde_Registry::AUTH_FAILURE) {
$ajax = Horde_Ajax::getInstance($app);
- $GLOBALS['notification']->push(str_replace('&', '&', Horde_Auth::getLogoutUrl(array('reason' => Horde_Auth::REASON_SESSION))), 'horde.ajaxtimeout', array('content.raw'));
+ $notification->push(str_replace('&', '&', $registry->getLogoutUrl(array('reason' => Horde_Auth::REASON_SESSION))), 'horde.ajaxtimeout', array('content.raw'));
Horde::sendHTTPResponse(Horde::prepareResponse(null, $ajax->notify), $ajax->responseType());
exit;
}
- Horde_Auth::authenticateFailure($app, $e);
+ $registry->authenticateFailure($app, $e);
}
}
Horde_Registry::appInit('horde', array('authentication' => 'none'));
if (!Horde_Auth::getAuth() && !$conf['menu']['always']) {
- Horde_Auth::authenticateFailure();
+ $registry->authenticateFailure();
}
$is_mozbar = (bool)Horde_Util::getFormData('mozbar');
if (!Jonah::checkPermissions('jonah:news', Horde_Perms::EDIT)) {
$notification->push(_("You are not authorised for this action."), 'horde.warning');
- Horde_Auth::authenticateFailure();
+ $registry->authenticateFailure();
}
$have_news = Jonah_News::getAvailableTypes();
try {
$registry->pushApp('kastalia', array('logintasks' => true));
} catch (Horde_Exception $e) {
- Horde_Auth::authenticateFailure('kastalia', $e);
+ $registry->authenticateFailure('kastalia', $e);
}
//################### </MANUELLER ANMELDE CHECK (WENN base.php NICHT INCLUDIERT WIRD)> ###################
try {
$registry->pushApp('kastalia', array('logintasks' => true));
} catch (Horde_Exception $e) {
- Horde_Auth::authenticateFailure('kastalia', $e);
+ $registry->authenticateFailure('kastalia', $e);
}
$conf = &$GLOBALS['conf'];
@define('KASTALIA_TEMPLATES', $registry->get('templates'));
// Is logged it?
if (!$registry->isAuthenticated()) {
$notification->push(_("Only authenticated users can post news."), 'horde.warning');
- Horde_Auth::authenticateFailure('news');
+ $registry->authenticateFailure('news');
}
// Default vars
/* Only admin should be using this. */
if (!$registry->isAdmin(array('permission' => 'news:admin'))) {
$notification->push(_("You are not authorised for this action."), 'horde.warning');
- Horde_Auth::authenticateFailure('news');
+ $registry->authenticateFailure('news');
}
$vars = Horde_Variables::getDefaultVariables();
try {
$registry->pushApp('news', array('check_perms' => (Horde_Util::nonInputVar('news_authentication') != 'none'), 'logintasks' => true));
} catch (Horde_Exception $e) {
- Horde_Auth::authenticateFailure('news', $e);
+ $registry->authenticateFailure('news', $e);
}
$conf = &$GLOBALS['conf'];
define('NEWS_TEMPLATES', $registry->get('templates'));
require_once dirname(__FILE__) . '/lib/base.php';
if (!$registry->isAuthenticated()) {
- Horde_Auth::authenticateFailure('news');
+ $registry->authenticateFailure('news');
}
$id = Horde_Util::getFormData('id', 0);
try {
$registry->pushApp('skoli', array('check_perms' => (Horde_Util::nonInputVar('skoli_authentication') != 'none'), 'logintasks' => true));
} catch (Horde_Exception $e) {
- Horde_Auth::authenticateFailure('skoli', $e);
+ $registry->authenticateFailure('skoli', $e);
}
$conf = &$GLOBALS['conf'];
@define('SKOLI_TEMPLATES', $registry->get('templates'));
/* Only admin should be using this. */
if (!Vilma::hasPermission($domain)) {
- Horde_Auth::authenticateFailure('vilma', $e);
+ $registry->authenticateFailure('vilma', $e);
}
$vars = Horde_Variables::getDefaultVariables();
/* Only admin should be using this. */
if (!Vilma::hasPermission($domain)) {
- Horde_Auth::authenticateFailure('vilma', $e);
+ $registry->authenticateFailure('vilma', $e);
}
//$domain_id = Horde_Util::getFormData('domain_id');
/* Only admin should be using this. */
if (!Vilma::hasPermission($domain)) {
- Horde_Auth::authenticateFailure('vilma', $e);
+ $registry->authenticateFailure('vilma', $e);
}
// Having a current domain doesn't make sense on this page
$registry->pushApp('vilma', !defined('AUTH_HANDLER'));
} catch (Horde_Exception $e) {
if ($e->getCode() == 'permission_denied') {
- Horde_Auth::authenticateFailure('vilma', $e);
+ $registry->authenticateFailure('vilma', $e);
}
Horde::fatal($e, __FILE__, __LINE__, false);
}
/* Only admin should be using this. */
if (!Vilma::hasPermission($domain)) {
- Horde_Auth::authenticateFailure('vilma', $e);
+ $registry->authenticateFailure('vilma', $e);
}
$vars = Horde_Variables::getDefaultVariables();
/* Only admin should be using this. */
if (!Vilma::hasPermission($domain)) {
- Horde_Auth::authenticateFailure('vilma', $e);
+ $registry->authenticateFailure('vilma', $e);
}
$vars = Horde_Variables::getDefaultVariables();
$address = $vars->get('address');
/* Only admin should be using this. */
if (!Vilma::hasPermission($domain)) {
- Horde_Auth::authenticateFailure('vilma', $e);
+ $registry->authenticateFailure('vilma', $e);
}
$vars = Variables::getDefaultVariables();
/* Only admin should be using this. */
if (!Vilma::hasPermission($domain)) {
- Horde_Auth::authenticateFailure('vilma', $e);
+ $registry->authenticateFailure('vilma', $e);
}
$vars = Variables::getDefaultVariables();
/* Only admin should be using this. */
if (!Vilma::hasPermission($curdomain)) {
- Horde_Auth::authenticateFailure('vilma', $e);
+ $registry->authenticateFailure('vilma', $e);
}
// Input validation: make sure we have a valid section
/* Only admin should be using this. */
if (!$registry->isAdmin()) {
- Horde_Auth::authenticateFailure('vilma', $e);
+ $registry->authenticateFailure('vilma', $e);
}
$vars = Horde_Variables::getDefaultVariables();
/* Only admin should be using this. */
if (!$registry->isAdmin() && !Vilma::isDomainAdmin()) {
- Horde_Auth::authenticateFailure('vilma', $e);
+ $registry->authenticateFailure('vilma', $e);
}
$domain = Vilma::getDomain();
/* Only admin should be using this. */
if (!$registry->isAdmin() && !Vilma::isDomainAdmin()) {
- Horde_Auth::authenticateFailure('vilma', $e);
+ $registry->authenticateFailure('vilma', $e);
}
$user = Horde_Util::getFormData('user');
Horde_Registry::appInit('whups');
if (!$registry->isAdmin(array('permission' => 'whups:admin'))) {
- Horde_Auth::authenticateFailure('whups', $e);
+ $registry->authenticateFailure('whups', $e);
}
// Set up the page config vars.