mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Merge branch 'MDL-53047-login-anchor' of https://github.com/brendanheywood/moodle
This commit is contained in:
commit
94d4d0179a
@ -37,6 +37,7 @@ redirect_if_major_upgrade_required();
|
||||
|
||||
$testsession = optional_param('testsession', 0, PARAM_INT); // test session works properly
|
||||
$cancel = optional_param('cancel', 0, PARAM_BOOL); // redirect to frontpage, needed for loginhttps
|
||||
$anchor = optional_param('anchor', '', PARAM_RAW); // Used to restore hash anchor to wantsurl.
|
||||
|
||||
if ($cancel) {
|
||||
redirect(new moodle_url('/'));
|
||||
@ -120,6 +121,15 @@ if ($user !== false or $frm !== false or $errormsg !== '') {
|
||||
$frm = data_submitted();
|
||||
}
|
||||
|
||||
// Restore the #anchor to the original wantsurl. Note that this
|
||||
// will only work for internal auth plugins, SSO plugins such as
|
||||
// SAML / CAS / OIDC will have to handle this correctly directly.
|
||||
if ($anchor && isset($SESSION->wantsurl) && strpos($SESSION->wantsurl, '#') === false) {
|
||||
$wantsurl = new moodle_url($SESSION->wantsurl);
|
||||
$wantsurl->set_anchor(substr($anchor, 1));
|
||||
$SESSION->wantsurl = $wantsurl->out();
|
||||
}
|
||||
|
||||
/// Check if the user has actually submitted login data to us
|
||||
|
||||
if ($frm and isset($frm->username)) { // Login WITH cookies
|
||||
|
@ -53,6 +53,8 @@ if (empty($CFG->authloginviaemail)) {
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="clearer"><!-- --></div>
|
||||
<input id="anchor" type="hidden" name="anchor" value="" />
|
||||
<script>document.getElementById('anchor').value = location.hash</script>
|
||||
<input type="submit" id="loginbtn" value="<?php print_string("login") ?>" />
|
||||
<div class="forgetpass"><a href="forgot_password.php"><?php print_string("forgotten") ?></a></div>
|
||||
</form>
|
||||
|
Loading…
x
Reference in New Issue
Block a user