diff --git a/backend/src/auth/auth.controller.ts b/backend/src/auth/auth.controller.ts index 3809ed6..e6d24b1 100644 --- a/backend/src/auth/auth.controller.ts +++ b/backend/src/auth/auth.controller.ts @@ -21,7 +21,7 @@ export class AuthController { @Post("signUp") signUp(@Body() dto: AuthRegisterDTO) { - if (!this.config.get("ALLOW_REGISTRATION")) + if (this.config.get("ALLOW_REGISTRATION") == "false") throw new ForbiddenException("Registration is not allowed"); return this.authService.signUp(dto); } diff --git a/frontend/src/pages/auth/signUp.tsx b/frontend/src/pages/auth/signUp.tsx index 9d136e3..b4e4464 100644 --- a/frontend/src/pages/auth/signUp.tsx +++ b/frontend/src/pages/auth/signUp.tsx @@ -1,14 +1,17 @@ +import getConfig from "next/config"; import { useRouter } from "next/router"; import AuthForm from "../../components/auth/AuthForm"; import Meta from "../../components/Meta"; import useUser from "../../hooks/user.hook"; +const { publicRuntimeConfig } = getConfig(); + const SignUp = () => { const user = useUser(); const router = useRouter(); if (user) { router.replace("/"); - } else if (process.env.NEXT_PUBLIC_DISABLE_REGISTRATION) { + } else if (publicRuntimeConfig.ALLOW_REGISTRATION == "false") { router.replace("/auth/signIn"); } else { return (