1
0
Fork 0
forked from s3lph/matemat

Fixed: Fetch receipt preference on login.

This commit is contained in:
s3lph 2018-09-09 03:38:23 +02:00
parent f11b0e0b93
commit 53233d74c3

View file

@ -176,14 +176,14 @@ class MatematDatabase(object):
raise ValueError('Exactly one of password and touchkey must be provided')
with self.db.transaction(exclusive=False) as c:
c.execute('''
SELECT user_id, username, email, password, touchkey, is_admin, is_member, balance
SELECT user_id, username, email, password, touchkey, is_admin, is_member, balance, receipt_pref
FROM users
WHERE username = ?
''', [username])
row = c.fetchone()
if row is None:
raise AuthenticationError('User does not exist')
user_id, username, email, pwhash, tkhash, admin, member, balance = row
user_id, username, email, pwhash, tkhash, admin, member, balance, receipt_pref = row
if password is not None and not compare_digest(crypt.crypt(password, pwhash), pwhash):
raise AuthenticationError('Password mismatch')
elif touchkey is not None \
@ -192,7 +192,7 @@ class MatematDatabase(object):
raise AuthenticationError('Touchkey mismatch')
elif touchkey is not None and tkhash is None:
raise AuthenticationError('Touchkey not set')
return User(user_id, username, balance, email, admin, member)
return User(user_id, username, balance, email, admin, member, receipt_pref)
def change_password(self, user: User, oldpass: str, newpass: str, verify_password: bool = True) -> None:
"""