redirect to new login route (#25099)
* redirect to new login route * encode anchor in url and restore it client-side
This commit is contained in:
parent
195fc5b048
commit
7f22aeb5d6
|
@ -962,9 +962,10 @@ class OC_Util {
|
||||||
public static function checkLoggedIn() {
|
public static function checkLoggedIn() {
|
||||||
// Check if we are a user
|
// Check if we are a user
|
||||||
if (!OC_User::isLoggedIn()) {
|
if (!OC_User::isLoggedIn()) {
|
||||||
header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php',
|
header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute(
|
||||||
|
'core.login.showLoginForm',
|
||||||
[
|
[
|
||||||
'redirect_url' => \OC::$server->getRequest()->getRequestUri()
|
'redirect_url' => urlencode(\OC::$server->getRequest()->getRequestUri()),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -368,6 +368,17 @@ $(document).ready(function () {
|
||||||
collection: collection
|
collection: collection
|
||||||
});
|
});
|
||||||
view.reload();
|
view.reload();
|
||||||
|
|
||||||
|
// 'redirect' to anchor sections
|
||||||
|
// anchors are lost on redirects (e.g. while solving the 2fa challenge) otherwise
|
||||||
|
// example: /settings/person?section=devices will result in /settings/person?#devices
|
||||||
|
if (!window.location.hash) {
|
||||||
|
var query = OC.parseQueryString(location.search);
|
||||||
|
if (query && query.section) {
|
||||||
|
OC.Util.History.replaceState({});
|
||||||
|
window.location.hash = query.section;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!OC.Encryption) {
|
if (!OC.Encryption) {
|
||||||
|
|
Loading…
Reference in New Issue