fix(hot): correctly update fields when RememberMe is sent.

note: this was originally planned so it would NOT store your data, however old codebases evolve and I had forgotten it did this, as once you click it once it will work for the rest of time.
This commit is contained in:
kittentm 2026-04-07 02:10:24 +02:00
commit 0947d1d1a6
No known key found for this signature in database
GPG key ID: AC43DFDBC1F44A91

View file

@ -44,20 +44,19 @@ async def login(
print(f"checking user {username}")
user = db.query(User).filter(User.username == username).first()
enc_pass = cipher.encrypt(password.encode()).decode()
if not user:
print("creating new user with argon2id")
enc_pass = cipher.encrypt(password.encode()).decode() if rememberMe else ""
user = User(
username=username,
local_hash=auth.hash_password(password),
spfn_pass_enc=enc_pass
)
db.add(user)
elif rememberMe:
print("updating encrypted pass for client")
user.spfn_pass_enc = cipher.encrypt(password.encode()).decode()
else:
print("client requested no password storage, skipping update")
print("updating encrypted pass for client")
user.spfn_pass_enc = enc_pass
db.flush()