Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Make token generation a little better
Browse files Browse the repository at this point in the history
  • Loading branch information
tdemin committed Jun 7, 2019
1 parent 6a01463 commit c4bbc6c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion project_amber/helpers/auth.py
Expand Up @@ -84,7 +84,7 @@ def createSession(name: str, password: str) -> str:
raise Unauthorized # this may present no sense, but the app doesn't
# have to reveal the presence or absence of a user in the system
if verifyPassword(user.id, password):
token = sha256(gensalt()).hexdigest()
token = sha256(gensalt() + bytes(str(time()).encode())).hexdigest()
session = Session(token=token, user=user.id, login_time=time())
db.session.add(session)
db.session.commit()
Expand Down

0 comments on commit c4bbc6c

Please sign in to comment.