mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-26 05:48:41 +00:00
fix(login): return url
This commit is contained in:
parent
f2f4ae9b4e
commit
d6fdff6588
@ -135,7 +135,7 @@ if (isset($_POST['login'])) {
|
|||||||
$('#help-username, #help-passwor, #help-captcha').html('');
|
$('#help-username, #help-passwor, #help-captcha').html('');
|
||||||
|
|
||||||
if (msg == 'ok') {
|
if (msg == 'ok') {
|
||||||
var prevUrl = document.referrer;
|
var prevUrl = new URLSearchParams(location.search).get('to') || document.referrer;
|
||||||
if (prevUrl == '' || /.*\/login.*/.test(prevUrl) || /.*\/logout.*/.test(prevUrl) || /.*\/register.*/.test(prevUrl) || /.*\/reset_password.*/.test(prevUrl)) {
|
if (prevUrl == '' || /.*\/login.*/.test(prevUrl) || /.*\/logout.*/.test(prevUrl) || /.*\/register.*/.test(prevUrl) || /.*\/reset_password.*/.test(prevUrl)) {
|
||||||
prevUrl = '/';
|
prevUrl = '/';
|
||||||
};
|
};
|
||||||
|
@ -69,9 +69,9 @@ function permanentlyRedirectToHTTP() {
|
|||||||
}
|
}
|
||||||
function redirectToLogin() {
|
function redirectToLogin() {
|
||||||
if (UOJContext::isAjax()) {
|
if (UOJContext::isAjax()) {
|
||||||
die('please <a href="' . HTML::url('/login') . '">login</a>');
|
die('please <a href="' . HTML::url('/login', ['params' => ['to' => UOJContext::requestPath()]]) . '">login</a>');
|
||||||
} else {
|
} else {
|
||||||
header('Location: ' . HTML::url('/login'));
|
header('Location: ' . HTML::url('/login', ['params' => ['to' => UOJContext::requestPath()]]));
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user