def update_db_info(self): if not self.username: return True # caller needs to check for anon if necessary # won't detect a change in hold state on first login... old_restriction = self.user_flags is not None and self.account_restricted() self.user_id, self.user_email, self.user_flags = userdb.get_user_info(self.username) self.logger.extra["username"] = self.username if userdb.dgl_is_banned(self.user_flags): return False if old_restriction and not self.account_restricted(): self.logger.info("[Account] Hold cleared for user %s (IP: %s)", self.username, self.request.remote_ip) return True
def go_lobby(self): if not config.get('dgl_mode'): return if self.is_running(): self.process.stop() if self.username and userdb.dgl_is_banned(self.user_flags): # force a logout. Note that this doesn't check the db at this point # in order to reduce i/o a bit. fail_reason = 'Account is disabled.' self.logger.warning("[Account] Logging out user %s: %s", self.username, fail_reason) self.username = self.user_email = self.user_flags = self.user_id = None self.send_message("go_lobby") self.send_lobby_html() self.send_message("logout", reason=fail_reason) return if self.watched_game: self.stop_watching() self.send_message("go_lobby") self.send_lobby() else: self.send_message("go_lobby")