mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-12-23 05:11:52 +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('');
|
||||
|
||||
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)) {
|
||||
prevUrl = '/';
|
||||
};
|
||||
|
@ -69,9 +69,9 @@ function permanentlyRedirectToHTTP() {
|
||||
}
|
||||
function redirectToLogin() {
|
||||
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 {
|
||||
header('Location: ' . HTML::url('/login'));
|
||||
header('Location: ' . HTML::url('/login', ['params' => ['to' => UOJContext::requestPath()]]));
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user