Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
misc: added check to backend
Sheen Capadngandb39d0371340
diff --git a/backend/src/services/auth/auth-login-service.ts b/backend/src/services/auth/auth-login-service.tsindex 8090b937ab..8207e4bec6 100644--- a/backend/src/services/auth/auth-login-service.ts+++ b/backend/src/services/auth/auth-login-service.ts@@ -17,6 +17,7 @@ import { TAuthTokenServiceFactory } from "../auth-token/auth-token-service";import { TokenType } from "../auth-token/auth-token-types";import { TOrgDALFactory } from "../org/org-dal";import { SmtpTemplates, TSmtpService } from "../smtp/smtp-service";+import { LoginMethod } from "../super-admin/super-admin-types";import { TUserDALFactory } from "../user/user-dal";import { enforceUserLockStatus, validateProviderAuthToken } from "./auth-fns";import {@@ -507,6 +508,40 @@ export const authLoginServiceFactory = ({let user = await userDAL.findUserByUsername(email);const serverCfg = await getServerCfg();+ if (serverCfg.enabledLoginMethods) {+ switch (authMethod) {+ case AuthMethod.GITHUB: {+ if (!serverCfg.enabledLoginMethods.includes(LoginMethod.GITHUB)) {+ throw new BadRequestError({+ message: "Login with Github is disabled.",+ name: "Oauth 2 login"+ });+ }+ break;+ }+ case AuthMethod.GOOGLE: {+ if (!serverCfg.enabledLoginMethods.includes(LoginMethod.GOOGLE)) {+ throw new BadRequestError({+ message: "Login with Google is disabled.",+ name: "Oauth 2 login"+ });+ }+ break;+ }+ case AuthMethod.GITLAB: {+ if (!serverCfg.enabledLoginMethods.includes(LoginMethod.GITLAB)) {+ throw new BadRequestError({+ message: "Login with Gitlab is disabled.",+ name: "Oauth 2 login"+ });+ }+ break;+ }+ default:+ break;+ }+ }+const appCfg = getConfig();if (!user) {diff --git a/frontend/src/views/Login/components/InitialStep/InitialStep.tsx b/frontend/src/views/Login/components/InitialStep/InitialStep.tsxindex d97126f671..99e80048af 100644--- a/frontend/src/views/Login/components/InitialStep/InitialStep.tsx+++ b/frontend/src/views/Login/components/InitialStep/InitialStep.tsx@@ -276,8 +276,8 @@ export const InitialStep = ({ setStep, email, setEmail, password, setPassword }:</Button></div>)}-- {shouldDisplayLoginMethod(LoginMethod.EMAIL) && config.enabledLoginMethods.length > 1 && (+ {(!config.enabledLoginMethods ||+ (shouldDisplayLoginMethod(LoginMethod.EMAIL) && config.enabledLoginMethods.length > 1)) && (<div className="my-4 flex w-1/4 min-w-[20rem] flex-row items-center py-2 lg:w-1/6"><div className="w-full border-t border-mineshaft-400/60" /><span className="mx-2 text-xs text-mineshaft-200">or</span>