File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -408,8 +408,13 @@ def post(cls):
408
408
The return value is an access token and the expiry timestamp.
409
409
The token is valid for 1 week.
410
410
"""
411
- user_id = get_jwt_identity ()
412
- access_token = create_access_token (identity = user_id )
411
+ req_user = get_jwt_identity ()
412
+ user = DAO .get_user (req_user ["id" ])
413
+
414
+ if user .password_hash != req_user ["password" ]:
415
+ return messages .TOKEN_IS_INVALID , HTTPStatus .UNAUTHORIZED
416
+
417
+ access_token = create_access_token (identity = req_user ["id" ])
413
418
414
419
from run import application
415
420
@@ -472,7 +477,9 @@ def post(cls):
472
477
)
473
478
474
479
access_token = create_access_token (identity = user .id )
475
- refresh_token = create_refresh_token (identity = user .id )
480
+ refresh_token = create_refresh_token (
481
+ identity = {"id" : user .id , "password" : user .password_hash }
482
+ )
476
483
477
484
from run import application
478
485
Original file line number Diff line number Diff line change @@ -31,7 +31,10 @@ def setUp(self):
31
31
32
32
def test_user_refresh (self ):
33
33
with self .client :
34
- refresh_header = get_test_request_header (user1 ["username" ], refresh = True )
34
+ refresh_header = get_test_request_header (
35
+ {"id" : self .first_user .id , "password" : self .first_user .password_hash },
36
+ refresh = True ,
37
+ )
35
38
response = self .client .post (
36
39
"/refresh" ,
37
40
headers = refresh_header ,
You can’t perform that action at this time.
0 commit comments