Implemented shared sessions between webclient and website - logging into either will also log in the player to the other. This is addresses the first point of #613.

This commit is contained in:
Griatch 2016-06-01 00:49:54 +02:00
parent eebd41f46d
commit f04c82fa17
7 changed files with 111 additions and 81 deletions

View file

@ -227,10 +227,10 @@ class ServerSession(Session):
# 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.browserid)
csession["logged_in"] = player.id
csession.save()
print ("serversession.login:", csession.session_key)
csession = ClientSessionStore(session_key=self.csessid)
if not csession.get("logged_in"):
csession["logged_in"] = player.id
csession.save()
# Update account's last login time.
self.player.last_login = timezone.now()