mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 14:02:32 +02:00
MDL-49003 login: prevent signup when user is logged in
This commit is contained in:
parent
78c36b065f
commit
6a2c10a89d
@ -144,6 +144,7 @@ $string['cannotsetupblock'] = 'Blocks tables could NOT be set up successfully!';
|
||||
$string['cannotsetupcapformod'] = 'Could not set up the capabilities for {$a}';
|
||||
$string['cannotsetupcapforplugin'] = 'Could not set up the capabilities for {$a}';
|
||||
$string['cannotshowhidecoursesincategory'] = 'Cannot show/hide the courses in category {$a}.';
|
||||
$string['cannotsignup'] = 'You cannot create a new account because you are already logged in as {$a}.';
|
||||
$string['cannotunassigncap'] = 'Could not unassign deprecated capability {$a->cap} from role {$a->role}';
|
||||
$string['cannotunassignrolefrom'] = 'Cannot unassign this user from role id: {$a}';
|
||||
$string['cannotunzipfile'] = 'Cannot unzip file';
|
||||
|
@ -48,6 +48,22 @@ $PAGE->https_required();
|
||||
$PAGE->set_url('/login/signup.php');
|
||||
$PAGE->set_context(context_system::instance());
|
||||
|
||||
// Override wanted URL, we do not want to end up here again if user clicks "Login".
|
||||
$SESSION->wantsurl = $CFG->wwwroot . '/';
|
||||
|
||||
if (isloggedin() and !isguestuser()) {
|
||||
// Prevent signing up when already logged in.
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->box_start();
|
||||
$logout = new single_button(new moodle_url($CFG->httpswwwroot . '/login/logout.php',
|
||||
array('sesskey' => sesskey(), 'loginpage' => 1)), get_string('logout'), 'post');
|
||||
$continue = new single_button(new moodle_url('/'), get_string('cancel'), 'get');
|
||||
echo $OUTPUT->confirm(get_string('cannotsignup', 'error', fullname($USER)), $logout, $continue);
|
||||
echo $OUTPUT->box_end();
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
$mform_signup = $authplugin->signup_form();
|
||||
|
||||
if ($mform_signup->is_cancelled()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user