Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Joxos committed Feb 17, 2024
1 parent a86b11f commit 20e3e7e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,5 +165,5 @@ cython_debug/
*#
future/
.vscode/
src/server.key
src/server.crt
pyasync_server/server/server.key
pyasync_server/server/server.crt
4 changes: 1 addition & 3 deletions pyasync_server/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"""
import asyncio
from pyasync_server.common.protocol import on_init, is_framed
from pyasync_server.common.utils import (
send_package,
)
from pyasync_server.common.utils import send_package
from pyasync_server.common.logging import show_status, STATUS
from pyasync_server.common.compress import decompress
from pyasync_server.client.package import unpack_and_process
Expand Down
5 changes: 4 additions & 1 deletion pyasync_server/server/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@ def database_test(sql):

# write your own actions here
def login(username, password):
if not os.path.exists("users.json"):
if not os.path.exists("./users.json"):
logger.error("users.json not found. Cannot login.")
return False
with open("users.json", "r") as f:
users = json.load(f)
if username in users and users[username] == password:
logger.info(f"User {username} logged in.")
return True
else:
logger.error(f"Invalid username or password for user {username}.")
return False


Expand Down
File renamed without changes.

0 comments on commit 20e3e7e

Please sign in to comment.