forked from s3lph/matemat
Fixed: Fetch receipt preference on login.
This commit is contained in:
parent
f11b0e0b93
commit
53233d74c3
1 changed files with 3 additions and 3 deletions
|
@ -176,14 +176,14 @@ class MatematDatabase(object):
|
||||||
raise ValueError('Exactly one of password and touchkey must be provided')
|
raise ValueError('Exactly one of password and touchkey must be provided')
|
||||||
with self.db.transaction(exclusive=False) as c:
|
with self.db.transaction(exclusive=False) as c:
|
||||||
c.execute('''
|
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
|
FROM users
|
||||||
WHERE username = ?
|
WHERE username = ?
|
||||||
''', [username])
|
''', [username])
|
||||||
row = c.fetchone()
|
row = c.fetchone()
|
||||||
if row is None:
|
if row is None:
|
||||||
raise AuthenticationError('User does not exist')
|
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):
|
if password is not None and not compare_digest(crypt.crypt(password, pwhash), pwhash):
|
||||||
raise AuthenticationError('Password mismatch')
|
raise AuthenticationError('Password mismatch')
|
||||||
elif touchkey is not None \
|
elif touchkey is not None \
|
||||||
|
@ -192,7 +192,7 @@ class MatematDatabase(object):
|
||||||
raise AuthenticationError('Touchkey mismatch')
|
raise AuthenticationError('Touchkey mismatch')
|
||||||
elif touchkey is not None and tkhash is None:
|
elif touchkey is not None and tkhash is None:
|
||||||
raise AuthenticationError('Touchkey not set')
|
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:
|
def change_password(self, user: User, oldpass: str, newpass: str, verify_password: bool = True) -> None:
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue