Browse Source

Address pycodestyle complaints

merge-requests/1/head
Drew Short 7 years ago
parent
commit
207c72fe54
  1. 13
      server/atheneum/service/user_service.py
  2. 4
      server/atheneum/service/user_token_service.py

13
server/atheneum/service/user_service.py

@ -7,14 +7,13 @@ from atheneum.service import authentication_service
def register(name: str, password: str, role: str) -> User:
password_hash, password_revision = authentication_service.get_password_hash(
password)
pw_hash, pw_revision = authentication_service.get_password_hash(password)
new_user = User(
name=name,
role=role,
password_hash=password_hash,
password_revision=password_revision,
password_hash=pw_hash,
password_revision=pw_revision,
creation_time=datetime.now(),
version=0)
db.session.add(new_user)
@ -38,10 +37,10 @@ def update_last_login_time(user: User):
def update_password(user: User, password: str):
password_hash, password_revision = authentication_service.get_password_hash(
pw_hash, pw_revision = authentication_service.get_password_hash(
password)
user.password_hash = password_hash
user.password_revision = password_revision
user.password_hash = pw_hash
user.password_revision = pw_revision
db.session.commit()

4
server/atheneum/service/user_token_service.py

@ -15,7 +15,8 @@ def create(
Create and save a UserToken
:param user: The User object to bind the token to
:param note: An optional field to store additional information about a token
:param note: An optional field to store additional information about a
token
:param enabled: A boolean to indicate whether a token can be considered
eligible for authentication
:param expiration_time: An optional argument to determine when the token
@ -49,4 +50,3 @@ def delete(user_token: UserToken) -> bool:
def find_by_user_and_token(user: User, token: str) -> Optional[UserToken]:
return UserToken.query.filter_by(user_id=user.id, token=token).first()
Loading…
Cancel
Save