Skip to content

Commit

Permalink
Make the registration operation vulnerable
Browse files Browse the repository at this point in the history
  • Loading branch information
dayeya committed Mar 16, 2024
1 parent 143ddc7 commit 4291245
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/db_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ def __init__(self) -> None:
print(f'[!] Unable to open database.')

def add_user(self, user: User) -> None:
query = f"""INSERT INTO users VALUES(?, ?, ?)"""
try:
query = f"""INSERT INTO users VALUES({user.name}, {user.password}, {user.registration})"""
conn = sql.connect(DB_FILE)
cursor = conn.cursor()
cursor.execute(query, (user.name, user.password, user.registration))
cursor.execute(query)

# Close all resources.
conn.commit()
Expand All @@ -44,7 +44,6 @@ def add_user(self, user: User) -> None:
def get_user(self, user_name: str, password: str) -> dict:
all_users = {}
query = f"SELECT * FROM users WHERE user_name = '{user_name}' AND password = '{password}'"

try:
conn = sql.connect(DB_FILE)
cursor = conn.cursor()
Expand Down

0 comments on commit 4291245

Please sign in to comment.