예제 #1
0
파일: index.php 프로젝트: blionut/elearning
    if (!$authorize_user) {
        $err['login'] = "******" . $authorize_error . "</p>";
        saml_error($err, '?logout', $pluginconfig->samllogfile);
    }
    // Just passes time as a password. User will never log in directly to moodle with this password anyway or so we hope?
    $user = authenticate_user_login($username, time());
    if ($user === false) {
        $err['login'] = get_string("auth_saml_error_authentication_process", "auth_saml", $username);
        saml_error($err['login'], '?logout', $pluginconfig->samllogfile);
    }
    // Complete the user login sequence
    $user = get_complete_user_data('id', $user->id);
    if ($user === false) {
        $err['login'] = get_string("auth_saml_error_complete_user_data", "auth_saml", $username);
        saml_error($err['login'], '?logout', $pluginconfig->samllogfile);
    }
    $USER = complete_user_login($user);
    if (function_exists('saml_hook_post_user_created')) {
        saml_hook_post_user_created($USER);
    }
    if (isset($SESSION->wantsurl) && !empty($SESSION->wantsurl)) {
        $urltogo = $SESSION->wantsurl;
    }
    $USER->loggedin = true;
    $USER->site = $CFG->wwwroot;
    set_moodle_cookie($USER->username);
    if (isset($err) && !empty($err)) {
        saml_error($err, $urltogo, $pluginconfig->samllogfile);
    }
    redirect($urltogo);
}
예제 #2
0
    if (!$authorize_user) {
        $err['login'] = "******" . $authorize_error . "</p>";
        auth_saml_error($err, '?logout', $pluginconfig->samllogfile);
    }
    // Just passes time as a password. User will never log in directly to moodle with this password anyway or so we hope?
    $user = authenticate_user_login($username, time());
    if ($user === false) {
        $err['login'] = get_string("auth_saml_error_authentication_process", "auth_saml", $username);
        auth_saml_error($err['login'], '?logout', $pluginconfig->samllogfile);
    }
    // Complete the user login sequence
    $user = get_complete_user_data('id', $user->id);
    if ($user === false) {
        $err['login'] = get_string("auth_saml_error_complete_user_data", "auth_saml", $username);
        auth_saml_error($err['login'], '?logout', $pluginconfig->samllogfile);
    }
    $USER = complete_user_login($user);
    if (function_exists('saml_hook_post_user_created')) {
        saml_hook_post_user_created($USER, $saml_attributes);
    }
    if (isset($SESSION->wantsurl) && !empty($SESSION->wantsurl)) {
        $urltogo = $SESSION->wantsurl;
    }
    $USER->loggedin = true;
    $USER->site = $CFG->wwwroot;
    set_moodle_cookie($USER->username);
    if (isset($err) && !empty($err)) {
        auth_saml_error($err, $urltogo, $pluginconfig->samllogfile);
    }
    redirect($urltogo);
}