|
|
|
@ -214,10 +214,26 @@ if (!empty($_SESSION['_user']['user_id']) && ! ($login || $logout)) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ((isset($_POST['login']) && isset($_POST['password']))) { |
|
|
|
//IF cas is activated and user isn't logged in |
|
|
|
|
|
|
|
if (api_get_setting('cas_activate') == 'true') { |
|
|
|
|
|
|
|
$cas_activated = true; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$cas_activated = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$cas_login=false; |
|
|
|
|
|
|
|
if ($cas_activated AND !isset($_user['user_id']) and !isset($_POST['login']) && !$logout) { |
|
|
|
|
|
|
|
require_once(api_get_path(SYS_PATH).'main/auth/cas/authcas.php'); |
|
|
|
|
|
|
|
$cas_login = cas_is_authenticated(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ( ( isset($_POST['login']) AND isset($_POST['password']) ) OR ($cas_login) ) { |
|
|
|
// $login && $password are given to log in |
|
|
|
// $login && $password are given to log in |
|
|
|
|
|
|
|
if ( $cas_login && empty($_POST['login']) ) { |
|
|
|
|
|
|
|
$login = $cas_login; |
|
|
|
|
|
|
|
} else { |
|
|
|
$login = $_POST['login']; |
|
|
|
$login = $_POST['login']; |
|
|
|
$password = $_POST['password']; |
|
|
|
$password = $_POST['password']; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//lookup the user in the main database |
|
|
|
//lookup the user in the main database |
|
|
|
$user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
|
|
$user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
|
|
@ -248,7 +264,7 @@ if (!empty($_SESSION['_user']['user_id']) && ! ($login || $logout)) { |
|
|
|
$password = api_get_encrypted_password($password); |
|
|
|
$password = api_get_encrypted_password($password); |
|
|
|
} |
|
|
|
} |
|
|
|
if (api_get_setting('allow_terms_conditions')=='true') { |
|
|
|
if (api_get_setting('allow_terms_conditions')=='true') { |
|
|
|
if ($password == $uData['password'] AND (trim($login) == $uData['username'])) { |
|
|
|
if ($password == $uData['password'] AND (trim($login) == $uData['username']) OR $cas_login ) { |
|
|
|
$temp_user_id = $uData['user_id']; |
|
|
|
$temp_user_id = $uData['user_id']; |
|
|
|
$term_and_condition_status=api_check_term_condition($temp_user_id);//false or true |
|
|
|
$term_and_condition_status=api_check_term_condition($temp_user_id);//false or true |
|
|
|
if ($term_and_condition_status===false) { |
|
|
|
if ($term_and_condition_status===false) { |
|
|
|
@ -265,7 +281,7 @@ if (!empty($_SESSION['_user']['user_id']) && ! ($login || $logout)) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Check the user's password |
|
|
|
// Check the user's password |
|
|
|
if ($password == $uData['password'] AND (trim($login) == $uData['username'])) { |
|
|
|
if ( ($password == $uData['password'] OR $cas_login) AND (trim($login) == $uData['username'])) { |
|
|
|
// Check if the account is active (not locked) |
|
|
|
// Check if the account is active (not locked) |
|
|
|
if ($uData['active']=='1') { |
|
|
|
if ($uData['active']=='1') { |
|
|
|
// Check if the expiration date has not been reached |
|
|
|
// Check if the expiration date has not been reached |
|
|
|
|