backoffice: add redirects from /manage/ (#12446) #530

Merged
fpeters merged 1 commits from wip/12446-redirect-manage into main 2023-08-02 10:29:44 +02:00
2 changed files with 13 additions and 0 deletions

View File

@ -192,6 +192,16 @@ def test_backoffice_home(pub):
resp.follow()
def test_backoffice_manage_redirect(pub):
app = get_app(pub)
assert app.get('/manage', status=302).location == 'http://example.net/backoffice'
assert app.get('/manage/studio/', status=302).location == 'http://example.net/backoffice/studio/'
assert (
app.get('/manage/studio/?param=1', status=302).location
== 'http://example.net/backoffice/studio/?param=1'
)
def test_backoffice_role_user(pub):
create_user(pub)
app = login(get_app(pub))

View File

@ -283,6 +283,9 @@ class RootDirectory(Directory):
get_publisher().substitutions.feed(get_request().user)
def _q_traverse(self, path):
if path and path[0] == 'manage':
return redirect('/backoffice' + get_request().get_path_query().removeprefix('/manage'))
self.forced_language = False
self.feed_substitution_parts()