Skip to content

Commit

Permalink
Modified logging for users logging in and for session creations
Browse files Browse the repository at this point in the history
  • Loading branch information
rickoooooo committed Dec 30, 2024
1 parent 1cd97f2 commit 9c27656
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions contexts/user_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from contexts.menu import Menu
from utils.user_db import UserDB
from utils.config import config
from utils.log import logger

'''
Authenticates a user to the BBS. When a user successfully authenticates, the context will switch to whatever the second menu object is in config.toml.
Expand Down Expand Up @@ -53,6 +54,7 @@ def receive_handler(self, packet: dict) -> str:
elif self.state == STATE_PASSWORD:
# Try to authenticate
if self.user_db.user_authenticate(self.username, text):
logger.info(f"User {self.username} logged in.")
self.message.body = "Login successful!"
self.session.send_message(self.message)
self.session.set_authenticated(self.username)
Expand All @@ -64,6 +66,7 @@ def receive_handler(self, packet: dict) -> str:

# User failed to authenticate
else:
logger.info(f"User {self.username} failed to log in.")
self.message.body = "Login failure!"
self.session.send_message(self.message)
self.session.revert_context()
Expand Down
2 changes: 1 addition & 1 deletion interfaces/comm_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def on_receive(self, packet: dict, interface) -> None:

# Does user have a session currently?
if session_db.check_session(user_id):
logger.info("User has session")
logger.debug("User has session")

# If the interface is None, it's because the connection is not from the Mesh but from TCP or something else
if interface != None:
Expand Down

0 comments on commit 9c27656

Please sign in to comment.