fix: invites when user_registration false

This commit is contained in:
diced 2022-11-01 18:19:07 -07:00
parent a1f281d8b4
commit 709e1da768
No known key found for this signature in database
GPG key ID: 370BD1BA142842D1
2 changed files with 3 additions and 2 deletions

View file

@ -7,7 +7,8 @@ import config from 'lib/config';
async function handler(req: NextApiReq, res: NextApiRes) {
if (req.method === 'POST' && req.body) {
if (!config.features.invites && req.body.code) return res.forbid('invites are disabled');
if (!config.features.user_registration) return res.forbid('user registration is disabled');
if (!config.features.user_registration && !req.body.code)
return res.forbid('user registration is disabled');
const { code, username, password } = req.body as {
code?: string;

View file

@ -163,7 +163,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
notFound: true,
};
if (!config.features.user_registration) return { notFound: true };
if (!config.features.user_registration && !code) return { notFound: true };
if (code) {
const invite = await prisma.invite.findUnique({