Force lowercase username, remove from session

This commit is contained in:
David Hoppenbrouwers
2022-10-08 15:42:04 +02:00
parent e9ef9140f0
commit 9acd5c0cdc
5 changed files with 26 additions and 12 deletions

View File

@@ -122,7 +122,7 @@ class DB:
return self._db().execute('''
select user_id, password
from users
where name = ?
where name = lower(?)
''',
(username,)
).fetchone()
@@ -138,7 +138,7 @@ class DB:
def get_user_private_info(self, user_id):
return self._db().execute('''
select about
select name, about
from users
where user_id = ?
''',
@@ -156,6 +156,15 @@ class DB:
)
db.commit()
def get_user_name(self, user_id):
return self._db().execute('''
select name
from users
where user_id = ?
''',
(user_id,)
).fetchone()
def add_thread(self, author_id, forum_id, title, text, time):
db = self._db()
c = db.cursor()
@@ -288,7 +297,7 @@ class DB:
c = db.cursor()
c.execute('''
insert into users(name, password, join_time)
values (?, ?, ?)
values (lower(?), ?, ?)
''',
(username, password, time)
)