diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index 25c8e1562a..1c75eb5faa 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 */ diff --git a/usr/local/www/system_usermanager.php b/usr/local/www/system_usermanager.php index b3403e9a23..9ff460b1dd 100644 --- a/usr/local/www/system_usermanager.php +++ b/usr/local/www/system_usermanager.php @@ -158,6 +158,7 @@ if (isAllowedPage("system_usermanager")) { $pconfig['uid'] = $a_user[$id]['uid']; $pconfig['authorizedkeys'] = base64_decode($a_user[$id]['authorizedkeys']); $pconfig['priv'] = $a_user[$id]['priv']; + $pconfig['disabled'] = isset($a_user[$id]['disabled']); } } @@ -252,6 +253,11 @@ if (isAllowedPage("system_usermanager")) { $userent['fullname'] = $_POST['fullname']; $userent['expires'] = $_POST['expires']; $userent['authorizedkeys'] = base64_encode($_POST['authorizedkeys']); + + if($_POST['disabled']) + $userent['disabled'] = true; + else + unset($userent['disabled']); if (isset($id) && $a_user[$id]) $a_user[$id] = $userent; @@ -371,6 +377,12 @@ function presubmit() { +
=gettext("Additional webConfigurator users can be added here.");?> =gettext("User permissions can be assinged diretly or inherited from group memberships.");?>