mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-78685 auth_oauth2: Added logged-in status check
This commit is contained in:
parent
9e665137d4
commit
033f742e4a
@ -48,11 +48,7 @@ if ($confirmed) {
|
||||
throw new \moodle_exception('cannotfinduser', '', '', $userid);
|
||||
}
|
||||
|
||||
if (!$user->suspended) {
|
||||
complete_user_login($user);
|
||||
|
||||
\core\session\manager::apply_concurrent_login_limit($user->id, session_id());
|
||||
|
||||
if ($user->id == $USER->id) {
|
||||
// Check where to go, $redirect has a higher preference.
|
||||
if (empty($redirect) and !empty($SESSION->wantsurl) ) {
|
||||
$redirect = $SESSION->wantsurl;
|
||||
@ -69,14 +65,24 @@ if ($confirmed) {
|
||||
$PAGE->set_heading($COURSE->fullname);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->box_start('generalbox centerpara boxwidthnormal boxaligncenter');
|
||||
echo "<h3>".get_string("thanks").", ". fullname($USER) . "</h3>\n";
|
||||
echo "<h3>".get_string("thanks").", ". fullname($user) . "</h3>\n";
|
||||
echo "<p>".get_string("confirmed")."</p>\n";
|
||||
echo $OUTPUT->single_button("$CFG->wwwroot/course/", get_string('courses'));
|
||||
// If $wantsurl and $redirect are empty, then the button will navigate the identical user to the dashboard.
|
||||
if ($user->id == $USER->id) {
|
||||
echo $OUTPUT->single_button("$CFG->wwwroot/course/", get_string('courses'));
|
||||
} else if (!isloggedin() || isguestuser()) {
|
||||
echo $OUTPUT->single_button(get_login_url(), get_string('login'));
|
||||
} else {
|
||||
echo $OUTPUT->single_button("$CFG->wwwroot/login/logout.php", get_string('logout'));
|
||||
}
|
||||
echo $OUTPUT->box_end();
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
} else {
|
||||
\core\notification::error(get_string('confirmationinvalid', 'auth_oauth2'));
|
||||
// Avoid error if logged-in user visiting the page.
|
||||
if (!isloggedin()) {
|
||||
\core\notification::error(get_string('confirmationinvalid', 'auth_oauth2'));
|
||||
}
|
||||
}
|
||||
|
||||
redirect("$CFG->wwwroot/");
|
||||
|
Loading…
x
Reference in New Issue
Block a user