diff options
author | sullrich <sullrich@pfsense.org> | 2009-11-27 19:02:39 -0500 |
---|---|---|
committer | sullrich <sullrich@pfsense.org> | 2009-11-27 19:02:57 -0500 |
commit | b4bfd25dc6804c288cd8ea804e0f5844899498fa (patch) | |
tree | 4b838b0ba8cc48b3023eee5193bbc1e8360c6d16 /etc/inc | |
parent | e7d3b8f4b8aa428882dd1f955027af8580690010 (diff) | |
download | pfsense-b4bfd25dc6804c288cd8ea804e0f5844899498fa.zip pfsense-b4bfd25dc6804c288cd8ea804e0f5844899498fa.tar.gz |
Add disabled checkbox. Add code to check for disabled accounts.
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/auth.inc | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index 25c8e15..1c75eb5 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -847,6 +847,16 @@ function get_user_expiration_date($username) { } } +function is_account_disabled($username) { + global $config; + foreach($config['system']['user'] as $user) { + if(isset($user['disabled'])) { + return true; + } + } + return false; +} + function session_auth($backing) { global $g, $debug, $HTTP_SERVER_VARS, $userindex, $config; @@ -858,14 +868,18 @@ function session_auth($backing) { $acct_expires = get_user_expiration_date($_POST['usernamefld']); if($acct_expires) { if (strtotime("-1 day") > strtotime(date("m/d/Y",strtotime($acct_expires)))) { - log_error("Account is now expired."); + echo "showajaxmessage('{$_SESSION['Login_Error']}');"; return; } } else { - $_SESSION['Logged_In'] = "True"; - $_SESSION['Username'] = $_POST['usernamefld']; - $_SESSION['last_access'] = time(); - log_error("Successful login for user '{$_POST['usernamefld']}' from: {$_SERVER['REMOTE_ADDR']}"); + if(is_account_disabled($_POST['usernamefld'])) { + echo "showajaxmessage('{$_SESSION['Login_Error']}');"; + } else { + $_SESSION['Logged_In'] = "True"; + $_SESSION['Username'] = $_POST['usernamefld']; + $_SESSION['last_access'] = time(); + log_error("Successful login for user '{$_POST['usernamefld']}' from: {$_SERVER['REMOTE_ADDR']}"); + } } } else { /* give the user a more detailed error message */ |