@@ -55,7 +55,21 @@ async def signin(request: Request):
55
55
redirect .set_cookie ('Authorization' , f'Bearer { token } ' )
56
56
return redirect
57
57
58
- return TEMPLATES .TemplateResponse ("accounts/login.html" , {"request" : request , "msg" : 'Wrong user or password' })
58
+ if (response .status_code == 500 ):
59
+ msg = 'Issue with the Server'
60
+
61
+ get_users_url = app .user_router .url_path_for ('get_users' )
62
+ users_request_url = base_url .__str__ () + get_users_url .__str__ ()[1 :]
63
+ http3client2 = http3 .AsyncClient ()
64
+ test_response = await http3client2 .get (users_request_url )
65
+ test_users = test_response .json ()
66
+ msg = 'Wrong User or Password'
67
+ for test_user in test_users :
68
+ print (test_user )
69
+ if form ['username' ]== test_user ['email' ]:
70
+ msg = 'Password is Wrong'
71
+
72
+ return TEMPLATES .TemplateResponse ("accounts/login.html" , {"request" : request , "msg" : msg })
59
73
60
74
61
75
@router .get ("/register" , status_code = status .HTTP_200_OK )
@@ -88,7 +102,7 @@ async def register(request: Request, response_model=HTMLResponse):
88
102
if (response .status_code == 500 ):
89
103
msg = 'Issue with the Server'
90
104
91
- get_users_url = app .user_router .url_path_for ('create_user ' )
105
+ get_users_url = app .user_router .url_path_for ('get_users ' )
92
106
users_request_url = base_url .__str__ () + get_users_url .__str__ ()[1 :]
93
107
http3client2 = http3 .AsyncClient ()
94
108
test_response = await http3client2 .get (users_request_url )
0 commit comments