Skip to content

Commit d28f0f3

Browse files
committed
feat(login error handling): Added invalid crendential error
1 parent 8d3c17d commit d28f0f3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

frontend/lib/pages/login.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ class _MyLoginState extends State<MyLogin> {
113113
SessionManager.setSession(cookies, asp);
114114

115115
return {'name': name ?? '', 'newCookies': cookies};
116+
}
117+
if (response.statusCode == 401) {
118+
_showError(response.data["detail"]);
116119
} else {
117120
_showError("Login failed: ${response.data["message"]}");
118121
return null;

frontend/lib/utils/util.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Future<Response> post(String url, Map<String, String> postheaders,
2929
options: Options(
3030
headers: postheaders,
3131
contentType: Headers.jsonContentType,
32-
validateStatus: (status) => status! < 400,
32+
validateStatus: (status) => status! < 500,
3333
));
3434
return response;
3535
}

0 commit comments

Comments
 (0)