Skip to content

Commit

Permalink
deploy: 999ce6f
Browse files Browse the repository at this point in the history
  • Loading branch information
Askaholic committed Jan 1, 2024
1 parent a43a6f9 commit 75f2709
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 9 deletions.
12 changes: 9 additions & 3 deletions exceptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ <h1 class="title">Module <code>server.exceptions</code></h1>
def message(self):
return (
f&#34;You are banned from FAF {self._ban_duration_text()}. &lt;br&gt;&#34;
f&#34;Reason: &lt;br&gt;{self.ban_reason}&#34;
f&#34;Reason: &lt;br&gt;{self.ban_reason}&lt;br&gt;&lt;br&gt;&#34;
&#34;&lt;i&gt;If you would like to appeal this ban, please send an email to: &#34;
&#34;[email protected]&lt;/i&gt;&#34;
)

def _ban_duration_text(self):
Expand Down Expand Up @@ -152,7 +154,9 @@ <h3>Ancestors</h3>
def message(self):
return (
f&#34;You are banned from FAF {self._ban_duration_text()}. &lt;br&gt;&#34;
f&#34;Reason: &lt;br&gt;{self.ban_reason}&#34;
f&#34;Reason: &lt;br&gt;{self.ban_reason}&lt;br&gt;&lt;br&gt;&#34;
&#34;&lt;i&gt;If you would like to appeal this ban, please send an email to: &#34;
&#34;[email protected]&lt;/i&gt;&#34;
)

def _ban_duration_text(self):
Expand Down Expand Up @@ -184,7 +188,9 @@ <h3>Methods</h3>
<pre><code class="python">def message(self):
return (
f&#34;You are banned from FAF {self._ban_duration_text()}. &lt;br&gt;&#34;
f&#34;Reason: &lt;br&gt;{self.ban_reason}&#34;
f&#34;Reason: &lt;br&gt;{self.ban_reason}&lt;br&gt;&lt;br&gt;&#34;
&#34;&lt;i&gt;If you would like to appeal this ban, please send an email to: &#34;
&#34;[email protected]&lt;/i&gt;&#34;
)</code></pre>
</details>
</dd>
Expand Down
75 changes: 69 additions & 6 deletions lobbyconnection.html
Original file line number Diff line number Diff line change
Expand Up @@ -545,16 +545,37 @@ <h1 class="title">Module <code>server.lobbyconnection</code></h1>

async with self._db.acquire() as conn:
result = await conn.execute(
select(t_login.c.login)
select(
t_login.c.login,
lobby_ban.c.reason,
lobby_ban.c.expires_at
)
.select_from(t_login.outerjoin(lobby_ban))
.where(t_login.c.id == player_id)
.order_by(lobby_ban.c.expires_at.desc())
)
row = result.fetchone()

if not row:
self._logger.warning(&#34;User id not found in database possible fraudulent token: %s&#34;, player_id)
self._logger.warning(
&#34;User id %s not found in database! Possible fraudulent &#34;
&#34;token: %s&#34;,
player_id,
token
)
raise AuthenticationError(&#34;Cannot find user id&#34;, auth_method)

username = row.login
ban_reason = row.reason
ban_expiry = row.expires_at

now = datetime.utcnow()
if ban_reason is not None and now &lt; ban_expiry:
self._logger.debug(
&#34;Rejected login from banned user: %s, %s, %s&#34;,
player_id, username, self.session
)
raise BanError(ban_expiry, ban_reason)

# DEPRECATED: IRC passwords are handled outside of the lobby server.
# This message remains here for backwards compatibility, but the data
Expand Down Expand Up @@ -1782,16 +1803,37 @@ <h2 class="section-title" id="header-classes">Classes</h2>

async with self._db.acquire() as conn:
result = await conn.execute(
select(t_login.c.login)
select(
t_login.c.login,
lobby_ban.c.reason,
lobby_ban.c.expires_at
)
.select_from(t_login.outerjoin(lobby_ban))
.where(t_login.c.id == player_id)
.order_by(lobby_ban.c.expires_at.desc())
)
row = result.fetchone()

if not row:
self._logger.warning(&#34;User id not found in database possible fraudulent token: %s&#34;, player_id)
self._logger.warning(
&#34;User id %s not found in database! Possible fraudulent &#34;
&#34;token: %s&#34;,
player_id,
token
)
raise AuthenticationError(&#34;Cannot find user id&#34;, auth_method)

username = row.login
ban_reason = row.reason
ban_expiry = row.expires_at

now = datetime.utcnow()
if ban_reason is not None and now &lt; ban_expiry:
self._logger.debug(
&#34;Rejected login from banned user: %s, %s, %s&#34;,
player_id, username, self.session
)
raise BanError(ban_expiry, ban_reason)

# DEPRECATED: IRC passwords are handled outside of the lobby server.
# This message remains here for backwards compatibility, but the data
Expand Down Expand Up @@ -2860,16 +2902,37 @@ <h3>Methods</h3>

async with self._db.acquire() as conn:
result = await conn.execute(
select(t_login.c.login)
select(
t_login.c.login,
lobby_ban.c.reason,
lobby_ban.c.expires_at
)
.select_from(t_login.outerjoin(lobby_ban))
.where(t_login.c.id == player_id)
.order_by(lobby_ban.c.expires_at.desc())
)
row = result.fetchone()

if not row:
self._logger.warning(&#34;User id not found in database possible fraudulent token: %s&#34;, player_id)
self._logger.warning(
&#34;User id %s not found in database! Possible fraudulent &#34;
&#34;token: %s&#34;,
player_id,
token
)
raise AuthenticationError(&#34;Cannot find user id&#34;, auth_method)

username = row.login
ban_reason = row.reason
ban_expiry = row.expires_at

now = datetime.utcnow()
if ban_reason is not None and now &lt; ban_expiry:
self._logger.debug(
&#34;Rejected login from banned user: %s, %s, %s&#34;,
player_id, username, self.session
)
raise BanError(ban_expiry, ban_reason)

# DEPRECATED: IRC passwords are handled outside of the lobby server.
# This message remains here for backwards compatibility, but the data
Expand Down

0 comments on commit 75f2709

Please sign in to comment.