mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-11440 working fix for require_user_key_login()
This commit is contained in:
parent
f4a01ab61f
commit
e2fa911b73
1 changed files with 8 additions and 1 deletions
|
@ -1957,7 +1957,7 @@ function require_course_login($courseorid, $autologinguest=true, $cm=null) {
|
|||
* @param int $instance optional instance id
|
||||
*/
|
||||
function require_user_key_login($script, $instance=null) {
|
||||
global $nomoodlecookie, $USER, $SESSION;
|
||||
global $nomoodlecookie, $USER, $SESSION, $CFG;
|
||||
|
||||
if (empty($nomoodlecookie)) {
|
||||
error('Incorrect use of require_key_login() - session cookies must be disabled!');
|
||||
|
@ -1991,6 +1991,13 @@ function require_user_key_login($script, $instance=null) {
|
|||
$SESSION = new object();
|
||||
$USER = $user;
|
||||
|
||||
/// note we are not using normal login
|
||||
if (!defined('USER_KEY_LOGIN')) {
|
||||
define('USER_KEY_LOGIN', true);
|
||||
}
|
||||
|
||||
load_all_capabilities();
|
||||
|
||||
/// return isntance id - it might be empty
|
||||
return $key->instance;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue