Skip to content

Commit 98c42aa

Browse files
committed
Admin: ensure "login_as" flag is off anytime we logout or login with username/password directly
1 parent 64e6d5f commit 98c42aa

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

main/inc/lib/online.inc.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ function online_logout($user_id = null, $logout_redirect = false)
217217
}
218218

219219
api_delete_firstpage_parameter();
220+
// If we were using "login_as", make sure this doesn't stick to the session
221+
if (Session::read('login_as') !== null) {
222+
Session::erase('login_as');
223+
}
220224
Session::erase('last_id');
221225
CourseChatUtils::exitChat($user_id);
222226
session_regenerate_id();

main/inc/local.inc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,8 @@
461461
$login = $_POST['login'];
462462
$password = $_POST['password'];
463463
}
464+
// unset the "login_as" flag if we just connected with a username and password.
465+
Session::erase('login_as');
464466

465467
$userManager = UserManager::getManager();
466468
$userRepository = UserManager::getRepository();

0 commit comments

Comments
 (0)