fix user signup disabled env could be set to anything to disable signup

This commit is contained in:
Matthias Nannt
2022-10-18 10:23:41 +02:00
parent 38366c5336
commit d6775a5cda
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ export default async function handle(req: NextApiRequest, res: NextApiResponse)
// Required fields in body: email, password (hashed)
// Optional fields in body: firstname, lastname
if (req.method === "POST") {
if (process.env.NEXT_PUBLIC_SIGNUP_DISABLED) {
if (process.env.NEXT_PUBLIC_SIGNUP_DISABLED === "1") {
res.status(403).json({ error: "Signup disabled" });
return;
}
+1 -1
View File
@@ -95,7 +95,7 @@ export default function SignInPage() {
</Link>
)}
{!process.env.NEXT_PUBLIC_SIGNUP_DISABLED && (
{process.env.NEXT_PUBLIC_SIGNUP_DISABLED !== "1" && (
<Link href="/auth/signup">
<a href="" className="text-red text-xs hover:text-red-600">
Create an account
+1 -1
View File
@@ -32,7 +32,7 @@ export default function SignUpPage() {
};
return (
<BaseLayoutUnauthorized title="Sign up">
{process.env.NEXT_PUBLIC_SIGNUP_DISABLED ? (
{process.env.NEXT_PUBLIC_SIGNUP_DISABLED === "1" ? (
<div className="bg-ui-gray-light flex min-h-screen">
<div className="mx-auto flex flex-1 flex-col justify-center px-4 py-12 sm:px-6 lg:flex-none lg:px-20 xl:px-24">
<div className="shadow-cont mx-auto w-full max-w-sm rounded-xl bg-white p-8 lg:w-96">