Redirect to previous page after login
This commit is contained in:
parent
865236fa7e
commit
dbffab099d
2 changed files with 7 additions and 1 deletions
|
@ -148,11 +148,13 @@ class Page
|
||||||
'changelog',
|
'changelog',
|
||||||
'wishlist',
|
'wishlist',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!isset($_SESSION['user'])
|
!isset($_SESSION['user'])
|
||||||
&& isset($_SESSION['_GET']['page'])
|
&& isset($_SESSION['_GET']['page'])
|
||||||
&& !in_array($_SESSION['_GET']['page'], $ignorePower)
|
&& !in_array($_SESSION['_GET']['page'], $ignorePower)
|
||||||
) {
|
) {
|
||||||
|
$_SESSION['REDIRECT_URL'] = $_SERVER['REQUEST_URI'];
|
||||||
redirect(Page::PAGE_LOGIN);
|
redirect(Page::PAGE_LOGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,11 @@ if (isset($_POST['login'], $_POST['email'], $_POST['password'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_SESSION['user'])) {
|
if (isset($_SESSION['user'])) {
|
||||||
redirect(Page::PAGE_HOME);
|
if (isset($_SESSION['REDIRECT_URL'])) {
|
||||||
|
redirect($_SESSION['REDIRECT_URL']);
|
||||||
|
} else {
|
||||||
|
redirect(Page::PAGE_HOME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue