Try except fix #26

Merged
H4CK3R-01 merged 3 commits from try_except_fix into main 2022-03-27 18:15:06 +00:00
2 changed files with 4 additions and 4 deletions
Showing only changes of commit c338e8f959 - Show all commits

View File

@ -17,5 +17,5 @@ def verify_token(token):
try:
jwt.decode(token, os.getenv('SECRET_KEY'), algorithms=["HS256"])
return True
except:
except jwt.PyJWTError:
return False

View File

@ -32,7 +32,7 @@ def extract_token_data(token):
if token is not None:
try:
return jwt.decode(token, os.getenv('SECRET_KEY'), algorithms=["HS256"])
except:
except jwt.PyJWTError:
return None
else:
return None
@ -52,13 +52,13 @@ def get_email_from_token_data():
return email
else:
return None
except:
except jwt.PyJWTError:
return None
else: # "Normal" token, extract username from token
try:
return jwt.decode(token, os.getenv('SECRET_KEY'), algorithms=["HS256"])['email']
except:
except jwt.PyJWTError:
return None
return None