Esempio n. 1
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);
}
Esempio n. 2
0
}
?>

<div align="right">
    <input type="submit" name="auth_saml_db_reset" value="<?php 
print_string('auth_saml_db_reset_button', 'auth_saml');
?>
" />
</div>

<table cellspacing="0" cellpadding="5" border="0">

<?php 
if (isset($err) && !empty($err)) {
    require_once 'error.php';
    auth_saml_error($err, false, $config->samllogfile);
    echo '
    <tr>
        <td class="center" colspan="4" style="background-color: red; color: white;text-">
    ';
    if (isset($err['reset'])) {
        echo $err['reset'];
    } else {
        print_string("auth_saml_form_error", "auth_saml");
    }
    echo '
        </td>
    </tr>
    ';
}
?>