fix: invites when user_registration false
This commit is contained in:
parent
a1f281d8b4
commit
709e1da768
2 changed files with 3 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -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({
|
||||
|
|
Loading…
Add table
Reference in a new issue