Пример #1
0
    def at_login(self, player):
        """
        Hook called by sessionhandler when the session becomes authenticated.

        Args:
            player (Player): The player associated with the session.

        """
        self.player = player
        self.uid = self.player.id
        self.uname = self.player.username
        self.logged_in = True
        self.conn_time = time()
        self.puid = None
        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"] = player.id
                csession.save()

        # Update account's last login time.
        self.player.last_login = timezone.now()
        self.player.save()

        # add the session-level cmdset
        self.cmdset = CmdSetHandler(self, True)
Пример #2
0
    def at_login(self, player):
        """
        Hook called by sessionhandler when the session becomes authenticated.

        player - the player associated with the session
        """
        self.player = player
        self.uid = self.player.id
        self.uname = self.player.username
        self.logged_in = True
        self.conn_time = time()
        self.puid = None
        self.puppet = None
        self.cmdset_storage = settings.CMDSET_SESSION

        # Update account's last login time.
        self.player.last_login = timezone.now()
        self.player.save()

        # add the session-level cmdset
        self.cmdset = CmdSetHandler(self, True)
Пример #3
0
    def at_login(self, account):
        """
        Hook called by sessionhandler when the session becomes authenticated.

        Args:
            account (Account): The account associated with the session.

        """
        self.account = account
        self.uid = self.account.id
        self.uname = self.account.username
        self.logged_in = True
        self.conn_time = time.time()
        self.puid = None
        self.puppet = None
        self.cmdset_storage = settings.CMDSET_SESSION

        # Update account's last login time.
        self.account.last_login = timezone.now()
        self.account.save()

        # add the session-level cmdset
        self.cmdset = CmdSetHandler(self, True)
Пример #4
0
 def __init__(self):
     """Initiate to avoid AttributeErrors down the line"""
     self.puppet = None
     self.account = None
     self.cmdset_storage_string = ""
     self.cmdset = CmdSetHandler(self, True)
Пример #5
0
 def cmdset(self):
     return CmdSetHandler(self, True)