LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
Handling USR ( user signup restrict ) error code (#242)
Siddhiq07baecd9d131
diff --git a/backend/account/authentication_controller.py b/backend/account/authentication_controller.pyindex 48fa8afdb..cb1bd2ed1 100644--- a/backend/account/authentication_controller.py+++ b/backend/account/authentication_controller.py@@ -147,13 +147,13 @@ class AuthenticationController:except Exception as ex:#self.user_logout(request)- if (- hasattr(ex, "code")- and ex.code == AuthorizationErrorCode.USF # type: ignore- ):+ if hasattr(ex, "code") and ex.code in {+ AuthorizationErrorCode.USF,+ AuthorizationErrorCode.USR,+ }: # type: ignoreresponse = Response(status=status.HTTP_412_PRECONDITION_FAILED,- data={"domain": ex.data.get("domain")}, # type: ignore+ data={"domain": ex.data.get("domain"), "code": ex.code},)return responseuser: User = request.userdiff --git a/backend/account/constants.py b/backend/account/constants.pyindex a88fb69c3..fe784a89f 100644--- a/backend/account/constants.py+++ b/backend/account/constants.py@@ -74,3 +74,4 @@ class AuthorizationErrorCode:UMM = "UMM"INF = "INF"USF = "USF"+ USR = "USR"diff --git a/frontend/src/components/error/GenericError/GenericError.jsx b/frontend/src/components/error/GenericError/GenericError.jsxindex 52e748fb0..a05f0de4c 100644--- a/frontend/src/components/error/GenericError/GenericError.jsx+++ b/frontend/src/components/error/GenericError/GenericError.jsx@@ -30,6 +30,11 @@ function GenericError() {subtitle:"You'll need to contact the admin of your organization's account to get access or you'll need to use a different email address to sign up.",},+ USR: {+ title: `Sign-up not allowed.`,+ subtitle:+ "You'll need to contact the admin of your organization's account to get access.",+ },// Add more key-value pairs as needed};diff --git a/frontend/src/hooks/useSessionValid.js b/frontend/src/hooks/useSessionValid.jsindex 30116f28b..d25cdde76 100644--- a/frontend/src/hooks/useSessionValid.js+++ b/frontend/src/hooks/useSessionValid.js@@ -113,8 +113,10 @@ function useSessionValid() {}if (err.request?.status === 412) {- const domainName = JSON.parse(err.request.response).domain;- window.location.href = `/error?code=USF&domain=${domainName}`;+ const response = JSON.parse(err.request.response);+ const domainName = response.domain;+ const code = response.code;+ window.location.href = `/error?code=${code}&domain=${domainName}`;// May be need a logout button there or auto logout}}