Add smarter shared login on website/webclient. Resolves #1063.
This makes it so that logging into the website will auto-log you into the webclient and vice-versa when you refresh the page. But if you log out of the web client will have to manually log in again. If you log out of the website and reload the webclient page you will have to log back into the client too (this is because logging out of the website flushes the browser session, it doesn't seem worth the effort to override django.auth in this).
This commit is contained in:
parent
0ac190b6ea
commit
cdac9678b9
7 changed files with 20 additions and 67 deletions
|
|
@ -20,8 +20,6 @@ from evennia.commands.cmdsethandler import CmdSetHandler
|
|||
from evennia.server.session import Session
|
||||
from evennia.scripts.monitorhandler import MONITOR_HANDLER
|
||||
|
||||
ClientSessionStore = importlib.import_module(settings.SESSION_ENGINE).SessionStore
|
||||
|
||||
_GA = object.__getattribute__
|
||||
_SA = object.__setattr__
|
||||
_ObjectDB = None
|
||||
|
|
@ -227,15 +225,6 @@ class ServerSession(Session):
|
|||
self.puppet = None
|
||||
self.cmdset_storage = settings.CMDSET_SESSION
|
||||
|
||||
if self.csessid:
|
||||
# An existing client sessid is registered, thus a matching
|
||||
# Client Session must also exist. Update it so the website
|
||||
# can also see we are logged in.
|
||||
csession = ClientSessionStore(session_key=self.csessid)
|
||||
if not csession.get("logged_in"):
|
||||
csession["logged_in"] = account.id
|
||||
csession.save()
|
||||
|
||||
# Update account's last login time.
|
||||
self.account.last_login = timezone.now()
|
||||
self.account.save()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue