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: """