Merge pull request #184 from linkwarden/dev
added the ability to disable registration
This commit is contained in:
commit
ea7f08aba2
|
@ -7,6 +7,7 @@ NEXTAUTH_URL=http://localhost:3000
|
||||||
PAGINATION_TAKE_COUNT=
|
PAGINATION_TAKE_COUNT=
|
||||||
STORAGE_FOLDER=
|
STORAGE_FOLDER=
|
||||||
AUTOSCROLL_TIMEOUT=
|
AUTOSCROLL_TIMEOUT=
|
||||||
|
NEXT_PUBLIC_DISABLE_REGISTRATION=
|
||||||
|
|
||||||
# AWS S3 Settings
|
# AWS S3 Settings
|
||||||
SPACES_KEY=
|
SPACES_KEY=
|
||||||
|
|
|
@ -20,6 +20,10 @@ export default async function Index(
|
||||||
req: NextApiRequest,
|
req: NextApiRequest,
|
||||||
res: NextApiResponse<Data>
|
res: NextApiResponse<Data>
|
||||||
) {
|
) {
|
||||||
|
if (process.env.NEXT_PUBLIC_DISABLE_REGISTRATION === "true") {
|
||||||
|
return res.status(400).json({ response: "Registration is disabled." });
|
||||||
|
}
|
||||||
|
|
||||||
const body: User = req.body;
|
const body: User = req.body;
|
||||||
|
|
||||||
const checkHasEmptyFields = emailEnabled
|
const checkHasEmptyFields = emailEnabled
|
||||||
|
|
|
@ -97,6 +97,7 @@ export default function Login() {
|
||||||
className=" w-full text-center"
|
className=" w-full text-center"
|
||||||
loading={submitLoader}
|
loading={submitLoader}
|
||||||
/>
|
/>
|
||||||
|
{process.env.NEXT_PUBLIC_DISABLE_REGISTRATION === "true" ? undefined : (
|
||||||
<div className="flex items-baseline gap-1 justify-center">
|
<div className="flex items-baseline gap-1 justify-center">
|
||||||
<p className="w-fit text-gray-500 dark:text-gray-400">New here?</p>
|
<p className="w-fit text-gray-500 dark:text-gray-400">New here?</p>
|
||||||
<Link
|
<Link
|
||||||
|
@ -106,6 +107,7 @@ export default function Login() {
|
||||||
Sign Up
|
Sign Up
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</CenteredForm>
|
</CenteredForm>
|
||||||
);
|
);
|
||||||
|
|
|
@ -99,6 +99,14 @@ export default function Register() {
|
||||||
: "Create a new account"
|
: "Create a new account"
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
{process.env.NEXT_PUBLIC_DISABLE_REGISTRATION === "true" ? (
|
||||||
|
<div className="p-4 flex flex-col gap-3 justify-between sm:w-[30rem] w-80 bg-slate-50 dark:bg-neutral-800 rounded-2xl shadow-md border border-sky-100 dark:border-neutral-700">
|
||||||
|
<p>
|
||||||
|
Registration is disabled for this instance, please contact the admin
|
||||||
|
in case of any issues.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
<div className="p-4 flex flex-col gap-3 justify-between sm:w-[30rem] w-80 bg-slate-50 dark:bg-neutral-800 rounded-2xl shadow-md border border-sky-100 dark:border-neutral-700">
|
<div className="p-4 flex flex-col gap-3 justify-between sm:w-[30rem] w-80 bg-slate-50 dark:bg-neutral-800 rounded-2xl shadow-md border border-sky-100 dark:border-neutral-700">
|
||||||
<p className="text-2xl text-black dark:text-white text-center font-bold">
|
<p className="text-2xl text-black dark:text-white text-center font-bold">
|
||||||
Enter your details
|
Enter your details
|
||||||
|
@ -227,6 +235,7 @@ export default function Register() {
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</CenteredForm>
|
</CenteredForm>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ declare global {
|
||||||
NEXTAUTH_SECRET: string;
|
NEXTAUTH_SECRET: string;
|
||||||
DATABASE_URL: string;
|
DATABASE_URL: string;
|
||||||
NEXTAUTH_URL: string;
|
NEXTAUTH_URL: string;
|
||||||
|
NEXT_PUBLIC_DISABLE_REGISTRATION?: string;
|
||||||
PAGINATION_TAKE_COUNT?: string;
|
PAGINATION_TAKE_COUNT?: string;
|
||||||
STORAGE_FOLDER?: string;
|
STORAGE_FOLDER?: string;
|
||||||
AUTOSCROLL_TIMEOUT?: string;
|
AUTOSCROLL_TIMEOUT?: string;
|
||||||
|
|
Ŝarĝante…
Reference in New Issue