1
0
mirror of https://github.com/stonith404/pingvin-share.git synced 2024-07-02 07:20:38 +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")
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);
}

View File

@ -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 (