From 53233d74c391855adbb7e3c35aaff6399de0d71d Mon Sep 17 00:00:00 2001 From: s3lph Date: Sun, 9 Sep 2018 03:38:23 +0200 Subject: [PATCH] Fixed: Fetch receipt preference on login. --- matemat/db/facade.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/matemat/db/facade.py b/matemat/db/facade.py index 2ceef8d..c7a7be7 100644 --- a/matemat/db/facade.py +++ b/matemat/db/facade.py @@ -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: """