diff --git a/.gitignore b/.gitignore index bbe75da..251423b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ client/build/ client/dist/** client/dist/ Pipfile -Pipfile.lock \ No newline at end of file +Pipfile.lock +test/xploit_test/.flag_queue.json \ No newline at end of file diff --git a/frontend/src/components/LoginProvider.tsx b/frontend/src/components/LoginProvider.tsx index f9798d2..e305105 100644 --- a/frontend/src/components/LoginProvider.tsx +++ b/frontend/src/components/LoginProvider.tsx @@ -1,7 +1,7 @@ import { postFormRequest } from "@/utils/net"; import { statusQuery } from "@/utils/queries"; import { useGlobalStore, useTokenStore } from "@/utils/stores"; -import { Box, Button, Group, PasswordInput, Space } from "@mantine/core" +import { Box, Button, Container, Group, PasswordInput, Space } from "@mantine/core" import { useForm } from '@mantine/form'; import { notifications } from '@mantine/notifications' import { useEffect } from "react"; @@ -28,6 +28,19 @@ export const LoginProvider = ({ children }: { children:any }) => { form.reset() },[token]) + if (status.isError){ + return + + + Check if the backend is running and reachable. + + + + + } if (status.data?.status == "setup"){ return @@ -41,51 +54,53 @@ export const LoginProvider = ({ children }: { children:any }) => { width: "100%", height: "100%", }}> - - -
{ - setLoading(true) - postFormRequest("login", {body: {username: "web-user", ...values}}) - .then( (res) => { - if(res.access_token){ - setToken(res.access_token) - status.refetch() - }else{ + + + + { + setLoading(true) + postFormRequest("login", {body: {username: "web-user", ...values}}) + .then( (res) => { + if(res.access_token){ + setToken(res.access_token) + status.refetch() + }else{ + notifications.show({ + title: "Unexpected Error", + message: res.detail??res??"Unknown error", + color: "red", + autoClose: 5000 + }) + } + }) + .catch( (err) => { notifications.show({ - title: "Unexpected Error", - message: res.detail??res??"Unknown error", + title: "Something went wrong!", + message: err.message??"Unknown error", color: "red", autoClose: 5000 }) - } - }) - .catch( (err) => { - notifications.show({ - title: "Something went wrong!", - message: err.message??"Unknown error", - color: "red", - autoClose: 5000 }) - }) - .finally(()=>{ - setLoading(false) - }) - })}> - - - - - - + .finally(()=>{ + setLoading(false) + }) + })}> + + + + + + +
} \ No newline at end of file diff --git a/tests/xploit_test/.flag_queue.json b/tests/xploit_test/.flag_queue.json index d0972e0..0fbfc50 100644 --- a/tests/xploit_test/.flag_queue.json +++ b/tests/xploit_test/.flag_queue.json @@ -1 +1 @@ -{"server_id":"62a1412f-3e92-4c20-8039-47c2eb8d52ec","queue":[]} \ No newline at end of file +{"server_id":"279e503e-dcf4-4103-98da-d2e0619ebcc9","queue":[]} \ No newline at end of file diff --git a/tests/xploit_test/config.toml b/tests/xploit_test/config.toml index 6692035..2c4178d 100644 --- a/tests/xploit_test/config.toml +++ b/tests/xploit_test/config.toml @@ -3,4 +3,4 @@ name = "xploit_test" interpreter = "python3" run = "main.py" language = "python" -service = "2244667d-0645-4930-8e9a-c6c5ea799258" +service = "9454014c-0be6-4f9e-9963-2c3ffb8aba8a"