fixed login error, db is now saved between different test runs

This commit is contained in:
b3yond 2018-03-22 10:34:53 +01:00
parent 390f4dc76e
commit ee8040893e

4
db.py
View file

@ -11,7 +11,7 @@ class DB(object):
def __init__(self): def __init__(self):
dbfile = path.join(path.dirname(path.abspath(__file__)), dbfile = path.join(path.dirname(path.abspath(__file__)),
'ticketfrei.sqlite') 'ticketfrei.sqlite')
dbfile = ':memory:' #dbfile = ':memory:'
self.conn = sqlite3.connect(dbfile) self.conn = sqlite3.connect(dbfile)
self.cur = self.conn.cursor() self.cur = self.conn.cursor()
self.cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='user';") self.cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='user';")
@ -113,7 +113,7 @@ class DB(object):
row = self.cur.fetchone() row = self.cur.fetchone()
if not row: if not row:
return None return None
if not scrypt_mcf_check(row[1].encode('ascii'), if not scrypt_mcf_check(row[1].decode('ascii').encode("utf-8"),
password.encode('utf-8')): password.encode('utf-8')):
return None return None
return User(self, row[0]) return User(self, row[0])