Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ dev.env
.envrc
*.code-workspace
/wrapper/create_template.sed
/package-lock.json
4 changes: 2 additions & 2 deletions functions/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def decode_token(token: str):
return decoded_token


def check_for_token(token):
def check_for_token(token: str):
"""Checks the token by trying to decode it.

Args:
Expand Down Expand Up @@ -50,4 +50,4 @@ def get_username_from_jwt(token: str):
Args:
token: token the username shall be extracted from
"""
return decode_token(token).get("username")
return decode_token(token).get("username")
7 changes: 4 additions & 3 deletions functions/db/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import os
import sys
import hashlib

from typing import Union
from bson import ObjectId
Expand Down Expand Up @@ -293,7 +294,7 @@ def add_user(username: str, name: str, surname: str, email: str, password: str)
user.name = name
user.surname = surname
user.email = email
user.password = password
user.password = hashlib.sha3_256(password.encode()).hexdigest()

return user.save()

Expand Down Expand Up @@ -324,7 +325,7 @@ def update_user(user: User, name, surname, email, password) -> User:
user.name = name
user.surname = surname
user.email = email
user.password = password
user.password = hashlib.sha3_256(password.encode())

return user.save()

Expand Down Expand Up @@ -375,7 +376,7 @@ def check_if_password_is_correct(user: User, password: str) -> bool:
user: User object the password shall be checked for
password: password as str that shall be checked
"""
if user.password == password:
if user.password == hashlib.sha3_256(password.encode()).hexdigest():
print("PW true")
return True
else:
Expand Down
Loading