|
@@ -624,7 +624,7 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
|
|
|
}
|
|
|
} elseif (KeyAuth::is_enabled()) {
|
|
|
$success = KeyAuth::instance()->login();
|
|
|
- if($success) {
|
|
|
+ if ($success) {
|
|
|
$use_anonymous = false;
|
|
|
}
|
|
|
}
|
|
@@ -633,7 +633,7 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) {
|
|
|
// $gidReset = true;
|
|
|
} // end else
|
|
|
|
|
|
-//Now check for anonymous user mode
|
|
|
+ // Now check for anonymous user mode
|
|
|
if (isset($use_anonymous) && $use_anonymous) {
|
|
|
//if anonymous mode is set, then try to set the current user as anonymous
|
|
|
//if he doesn't have a login yet
|
|
@@ -658,14 +658,13 @@ if (!empty($cidReq) && (!isset($_SESSION['_cid']) or (isset($_SESSION['_cid']) &
|
|
|
}
|
|
|
|
|
|
/* USER INIT */
|
|
|
-
|
|
|
if (isset($uidReset) && $uidReset) {
|
|
|
// session data refresh requested
|
|
|
unset($_SESSION['_user']['uidReset']);
|
|
|
$is_platformAdmin = false;
|
|
|
$is_allowedCreateCourse = false;
|
|
|
-
|
|
|
- if (isset($_user['user_id']) && $_user['user_id']) {
|
|
|
+ if (isset($_user['user_id']) && $_user['user_id'] && !api_is_anonymous()) {
|
|
|
+ //if (isset($_user['user_id']) && $_user['user_id']) {
|
|
|
// a uid is given (log in succeeded)
|
|
|
|
|
|
$_SESSION['loginFailed'] = false;
|
|
@@ -708,12 +707,14 @@ if (isset($uidReset) && $uidReset) {
|
|
|
//exit("WARNING UNDEFINED UID !! ");
|
|
|
}
|
|
|
} else {
|
|
|
- // no uid => logout or Anonymous
|
|
|
- Session::erase('_user');
|
|
|
- Session::erase('_uid');
|
|
|
+ if (!api_is_anonymous()) {
|
|
|
+ // no uid => logout or Anonymous
|
|
|
+ Session::erase('_user');
|
|
|
+ Session::erase('_uid');
|
|
|
+ }
|
|
|
}
|
|
|
- Session::write('is_platformAdmin',$is_platformAdmin);
|
|
|
- Session::write('is_allowedCreateCourse',$is_allowedCreateCourse);
|
|
|
+ Session::write('is_platformAdmin', $is_platformAdmin);
|
|
|
+ Session::write('is_allowedCreateCourse', $is_allowedCreateCourse);
|
|
|
} else { // continue with the previous values
|
|
|
$_user = $_SESSION['_user'];
|
|
|
$is_platformAdmin = isset($_SESSION['is_platformAdmin']) ? $_SESSION['is_platformAdmin'] : false;
|