change(python): use transaction query in BasicAuthBackend

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2022-01-16 02:01:52 -08:00
parent 64069b9b5d
commit eb59cbaa39
No known key found for this signature in database
GPG key ID: F7E46DED420788F3

View file

@ -122,8 +122,8 @@ class BasicAuthBackend(AuthenticationBackend):
# At this point, we cannot have an invalid user if the record # At this point, we cannot have an invalid user if the record
# exists, due to ForeignKey constraints in the schema upheld # exists, due to ForeignKey constraints in the schema upheld
# by mysqlclient. # by mysqlclient.
with db.begin():
user = db.query(User).filter(User.ID == record.UsersID).first() user = db.query(User).filter(User.ID == record.UsersID).first()
db.refresh(user)
user.nonce = util.make_nonce() user.nonce = util.make_nonce()
user.authenticated = True user.authenticated = True