forked from spacebar/SplatNet-Backend
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:
parent
17c4eace0c
commit
0947d1d1a6
1 changed files with 4 additions and 5 deletions
|
|
@ -44,20 +44,19 @@ async def login(
|
||||||
print(f"checking user {username}")
|
print(f"checking user {username}")
|
||||||
user = db.query(User).filter(User.username == username).first()
|
user = db.query(User).filter(User.username == username).first()
|
||||||
|
|
||||||
|
enc_pass = cipher.encrypt(password.encode()).decode()
|
||||||
|
|
||||||
if not user:
|
if not user:
|
||||||
print("creating new user with argon2id")
|
print("creating new user with argon2id")
|
||||||
enc_pass = cipher.encrypt(password.encode()).decode() if rememberMe else ""
|
|
||||||
user = User(
|
user = User(
|
||||||
username=username,
|
username=username,
|
||||||
local_hash=auth.hash_password(password),
|
local_hash=auth.hash_password(password),
|
||||||
spfn_pass_enc=enc_pass
|
spfn_pass_enc=enc_pass
|
||||||
)
|
)
|
||||||
db.add(user)
|
db.add(user)
|
||||||
elif rememberMe:
|
|
||||||
print("updating encrypted pass for client")
|
|
||||||
user.spfn_pass_enc = cipher.encrypt(password.encode()).decode()
|
|
||||||
else:
|
else:
|
||||||
print("client requested no password storage, skipping update")
|
print("updating encrypted pass for client")
|
||||||
|
user.spfn_pass_enc = enc_pass
|
||||||
|
|
||||||
db.flush()
|
db.flush()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue