1
0
mirror of https://github.com/stonith404/pingvin-share.git synced 2024-07-04 08:20:13 +02:00

fix: wrong environment configuration for ALLOW_REGISTRATION

This commit is contained in:
Elias Schneider 2022-10-11 23:21:14 +02:00
parent 395f618bb2
commit 759db40ac9
2 changed files with 5 additions and 2 deletions

View File

@ -21,7 +21,7 @@ export class AuthController {
@Post("signUp") @Post("signUp")
signUp(@Body() dto: AuthRegisterDTO) { signUp(@Body() dto: AuthRegisterDTO) {
if (!this.config.get("ALLOW_REGISTRATION")) if (this.config.get("ALLOW_REGISTRATION") == "false")
throw new ForbiddenException("Registration is not allowed"); throw new ForbiddenException("Registration is not allowed");
return this.authService.signUp(dto); return this.authService.signUp(dto);
} }

View File

@ -1,14 +1,17 @@
import getConfig from "next/config";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import AuthForm from "../../components/auth/AuthForm"; import AuthForm from "../../components/auth/AuthForm";
import Meta from "../../components/Meta"; import Meta from "../../components/Meta";
import useUser from "../../hooks/user.hook"; import useUser from "../../hooks/user.hook";
const { publicRuntimeConfig } = getConfig();
const SignUp = () => { const SignUp = () => {
const user = useUser(); const user = useUser();
const router = useRouter(); const router = useRouter();
if (user) { if (user) {
router.replace("/"); router.replace("/");
} else if (process.env.NEXT_PUBLIC_DISABLE_REGISTRATION) { } else if (publicRuntimeConfig.ALLOW_REGISTRATION == "false") {
router.replace("/auth/signIn"); router.replace("/auth/signIn");
} else { } else {
return ( return (