File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 99from jinja2 import Template
1010from jwt .exceptions import InvalidTokenError
1111
12+ from app .core import security
1213from app .core .config import settings
1314
1415logging .basicConfig (level = logging .INFO )
@@ -107,14 +108,16 @@ def generate_password_reset_token(email: str) -> str:
107108 encoded_jwt = jwt .encode (
108109 {"exp" : exp , "nbf" : now , "sub" : email },
109110 settings .SECRET_KEY ,
110- algorithm = "HS256" ,
111+ algorithm = security . ALGORITHM ,
111112 )
112113 return encoded_jwt
113114
114115
115116def verify_password_reset_token (token : str ) -> str | None :
116117 try :
117- decoded_token = jwt .decode (token , settings .SECRET_KEY , algorithms = ["HS256" ])
118+ decoded_token = jwt .decode (
119+ token , settings .SECRET_KEY , algorithms = [security .ALGORITHM ]
120+ )
118121 return str (decoded_token ["sub" ])
119122 except InvalidTokenError :
120123 return None
You can’t perform that action at this time.
0 commit comments