Skip to content

Commit

Permalink
Better login logging
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Mar 21, 2014
1 parent b699c43 commit 61ee8f1
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions horde/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,14 @@ function _addAnchor($url, $type, $vars, $url_anchor = null)
}
$is_auth = null;

$entry = sprintf('User %s [%s] logged out of Horde', $registry->getAuth(), $_SERVER['REMOTE_ADDR']);
Horde::log($entry, 'NOTICE');
Horde::log(
sprintf(
'User %s logged out of Horde (%s)',
$registry->getAuth(),
$_SERVER['REMOTE_ADDR']
),
'NOTICE'
);
}

$registry->clearAuth();
Expand Down Expand Up @@ -147,8 +153,15 @@ function _addAnchor($url, $type, $vars, $url_anchor = null)
} catch (Horde_Exception $e) {}

if ($auth->authenticate(Horde_Util::getPost('horde_user'), $auth_params)) {
$entry = sprintf('Login success for %s [%s] to %s.', $registry->getAuth(), $_SERVER['REMOTE_ADDR'], ($vars->app && $is_auth) ? $vars->app : 'horde');
Horde::log($entry, 'NOTICE');
Horde::log(
sprintf(
'Login success for %s to %s (%s)',
$registry->getAuth(),
($vars->app && $is_auth) ? $vars->app : 'horde',
$_SERVER['REMOTE_ADDR']
),
'NOTICE'
);

if (!$is_auth && $nojs) {
$notification->push(_("JavaScript is either disabled or not available on your browser. You are restricted to the minimal view."));
Expand All @@ -174,9 +187,16 @@ function _addAnchor($url, $type, $vars, $url_anchor = null)
}

$logout_reason = $auth->getError();
$entry = sprintf('FAILED LOGIN for %s [%s] to Horde',
$vars->horde_user, $_SERVER['REMOTE_ADDR']);
Horde::log($entry, 'ERR');

Horde::log(
sprintf(
'FAILED LOGIN for %s to %s (%s)',
$vars->horde_user,
($vars->app && $is_auth) ? $vars->app : 'horde',
$_SERVER['REMOTE_ADDR']
),
'ERR'
);
}

/* Build the list of necessary login parameters.
Expand Down

0 comments on commit 61ee8f1

Please sign in to comment.