Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

feat: Add auth error code for forbidden emails (#1789)

Hari John Kuriakose2d4433ab35e6
diff --git a/backend/account_v2/constants.py b/backend/account_v2/constants.py
index fc45c6320..4168dfd4a 100644
--- a/backend/account_v2/constants.py
+++ b/backend/account_v2/constants.py
@@ -74,9 +74,11 @@ class AuthorizationErrorCode:
INF: INVITATION NOT FOUND (Invitation is either invalid or has expired)
UMM: USER MEMBERSHIP MISCONDUCT
USF: USER FOUND (User Account Already Exists for Organization)
- INE001: INVALID EMAIL Exception code when an invalid email address is used
- like disposable.
+ INE001: INVALID EMAIL Exception code when an email address is invalid as
+ it has a disposable domain.
INE002: INVALID EMAIL Exception code when an invalid email address format.
+ INE003: INVALID EMAIL Exception code when an email address is invalid as
+ it is forbidden.
INS: Insufficient Access
Error code reference :
@@ -90,4 +92,5 @@ class AuthorizationErrorCode:
USR = "USR"
INE001 = "INE001"
INE002 = "INE002"
+ INE003 = "INE003"
INS = "INS"
diff --git a/docker/dockerfiles/frontend.Dockerfile b/docker/dockerfiles/frontend.Dockerfile
index 20b8fde2f..4d6a56919 100644
--- a/docker/dockerfiles/frontend.Dockerfile
+++ b/docker/dockerfiles/frontend.Dockerfile
@@ -11,6 +11,7 @@ WORKDIR /app
### FOR DEVELOPMENT ###
# Development stage for hot-reloading
FROM base AS development
+ARG BUILD_CONTEXT_PATH
# Copy only package files for dependency caching
COPY ${BUILD_CONTEXT_PATH}/package.json ${BUILD_CONTEXT_PATH}/package-lock.json ./
@@ -23,7 +24,9 @@ COPY ${BUILD_CONTEXT_PATH}/ /app/
COPY ${BUILD_CONTEXT_PATH}/generate-runtime-config.sh /app/generate-runtime-config.sh
RUN chmod +x /app/generate-runtime-config.sh
-EXPOSE 3000
+# Set dev server to run on port 80 to match production nginx
+ENV PORT=80
+EXPOSE 80
# Run the environment config script before starting the
# dev server, as the node alpine base image does not
@@ -33,6 +36,7 @@ CMD ["/bin/sh", "-c", "/app/generate-runtime-config.sh && npm start"]
### FOR PRODUCTION ###
# Builder stage for production build
FROM base AS builder
+ARG BUILD_CONTEXT_PATH
ARG REACT_APP_ENABLE_POSTHOG=true
ENV REACT_APP_BACKEND_URL=""
ENV REACT_APP_ENABLE_POSTHOG=${REACT_APP_ENABLE_POSTHOG}
diff --git a/frontend/src/components/error/GenericError/GenericError.jsx b/frontend/src/components/error/GenericError/GenericError.jsx
index cf2d82566..29882d97a 100644
--- a/frontend/src/components/error/GenericError/GenericError.jsx
+++ b/frontend/src/components/error/GenericError/GenericError.jsx
@@ -43,6 +43,10 @@ function GenericError() {
title: `Invalid Email format`,
subtitle: "Please give a valid email address",
},
+ INE003: {
+ title: `Email not allowed`,
+ subtitle: "This email is forbidden.",
+ },
INS: {
title: `Access Denied`,
subtitle: "Please contact your administrator to request access.",
diff --git a/frontend/src/components/log-in/Login.jsx b/frontend/src/components/log-in/Login.jsx
index 93db1191a..b1b2ab4ce 100644
--- a/frontend/src/components/log-in/Login.jsx
+++ b/frontend/src/components/log-in/Login.jsx
@@ -15,16 +15,22 @@ try {
function Login() {
const baseUrl = getBaseUrl();
- const newURL = baseUrl + "/api/v1/login";
+ const loginURL = baseUrl + "/api/v1/login";
+ const signupURL = baseUrl + "/api/v1/signup";
+
const handleLogin = () => {
- window.location.href = newURL;
+ window.location.href = loginURL;
+ };
+
+ const handleSignup = () => {
+ window.location.href = signupURL;
};
return (
<div className="login-main">
<Row>
{LoginForm ? (
- <LoginForm handleLogin={handleLogin} />
+ <LoginForm handleLogin={handleLogin} handleSignup={handleSignup} />
) : (
<>
<Col xs={24} md={12} className="login-left-section">