implement redirect on login
This commit is contained in:
parent
9942b3baf2
commit
5282b5f8df
@ -1,6 +1,11 @@
|
||||
from .template import WebpageController
|
||||
from .session import SessionStorage
|
||||
from owrx.config import Config
|
||||
from urllib import parse
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Authentication(object):
|
||||
@ -24,4 +29,5 @@ class AdminController(WebpageController):
|
||||
if self.authentication.isAuthenticated(self.request):
|
||||
super().handle_request()
|
||||
else:
|
||||
self.send_redirect("/login")
|
||||
target = "/login?{0}".format(parse.urlencode({"ref": self.request.path}))
|
||||
self.send_redirect(target)
|
||||
|
@ -50,8 +50,8 @@ class SessionController(WebpageController):
|
||||
key = SessionStorage.getSharedInstance().startSession({"user": user.name})
|
||||
cookie = SimpleCookie()
|
||||
cookie["owrx-session"] = key
|
||||
# TODO pass the final destination
|
||||
self.send_redirect("/settings", cookies=cookie)
|
||||
target = self.request.query["ref"][0] if "ref" in self.request.query else "/settings"
|
||||
self.send_redirect(target, cookies=cookie)
|
||||
return
|
||||
self.send_redirect("/login")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user