File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 8
8
from jinja2 import Template
9
9
from jose import JWTError , jwt
10
10
11
+ from app .core import security
11
12
from app .core .config import settings
12
13
13
14
@@ -103,14 +104,16 @@ def generate_password_reset_token(email: str) -> str:
103
104
encoded_jwt = jwt .encode (
104
105
{"exp" : exp , "nbf" : now , "sub" : email },
105
106
settings .SECRET_KEY ,
106
- algorithm = "HS256" ,
107
+ algorithm = security . ALGORITHM ,
107
108
)
108
109
return encoded_jwt
109
110
110
111
111
112
def verify_password_reset_token (token : str ) -> str | None :
112
113
try :
113
- decoded_token = jwt .decode (token , settings .SECRET_KEY , algorithms = ["HS256" ])
114
+ decoded_token = jwt .decode (
115
+ token , settings .SECRET_KEY , algorithms = [security .ALGORITHM ]
116
+ )
114
117
return str (decoded_token ["sub" ])
115
118
except JWTError :
116
119
return None
You can’t perform that action at this time.
0 commit comments