We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 98bd7e6 commit 33d74b2Copy full SHA for 33d74b2
1 file changed
backend/app/utils.py
@@ -8,6 +8,7 @@
8
from jinja2 import Template
9
from jose import JWTError, jwt
10
11
+from app.core import security
12
from app.core.config import settings
13
14
@@ -103,14 +104,16 @@ def generate_password_reset_token(email: str) -> str:
103
104
encoded_jwt = jwt.encode(
105
{"exp": exp, "nbf": now, "sub": email},
106
settings.SECRET_KEY,
- algorithm="HS256",
107
+ algorithm=security.ALGORITHM,
108
)
109
return encoded_jwt
110
111
112
def verify_password_reset_token(token: str) -> str | None:
113
try:
- decoded_token = jwt.decode(token, settings.SECRET_KEY, algorithms=["HS256"])
114
+ decoded_token = jwt.decode(
115
+ token, settings.SECRET_KEY, algorithms=[security.ALGORITHM]
116
+ )
117
return str(decoded_token["sub"])
118
except JWTError:
119
return None
0 commit comments