minor improvement
This commit is contained in:
parent
2524139113
commit
d1c3748681
|
@ -36,7 +36,6 @@ PREVIEW_MAX_BUFFER=
|
||||||
IMPORT_LIMIT=
|
IMPORT_LIMIT=
|
||||||
PLAYWRIGHT_LAUNCH_OPTIONS_EXECUTABLE_PATH=
|
PLAYWRIGHT_LAUNCH_OPTIONS_EXECUTABLE_PATH=
|
||||||
MAX_WORKERS=
|
MAX_WORKERS=
|
||||||
DISABLE_INVITES=
|
|
||||||
|
|
||||||
# AWS S3 Settings
|
# AWS S3 Settings
|
||||||
SPACES_KEY=
|
SPACES_KEY=
|
||||||
|
|
|
@ -22,8 +22,6 @@ export default async function postUser(
|
||||||
const isAdmin =
|
const isAdmin =
|
||||||
parentUser && parentUser.id === Number(process.env.NEXT_PUBLIC_ADMIN || 1);
|
parentUser && parentUser.id === Number(process.env.NEXT_PUBLIC_ADMIN || 1);
|
||||||
|
|
||||||
const DISABLE_INVITES = process.env.DISABLE_INVITES === "true";
|
|
||||||
|
|
||||||
if (process.env.NEXT_PUBLIC_DISABLE_REGISTRATION === "true" && !isAdmin) {
|
if (process.env.NEXT_PUBLIC_DISABLE_REGISTRATION === "true" && !isAdmin) {
|
||||||
return { response: "Registration is disabled.", status: 400 };
|
return { response: "Registration is disabled.", status: 400 };
|
||||||
}
|
}
|
||||||
|
@ -42,7 +40,7 @@ export default async function postUser(
|
||||||
const { name, email, password, invite } = dataValidation.data;
|
const { name, email, password, invite } = dataValidation.data;
|
||||||
let { username } = dataValidation.data;
|
let { username } = dataValidation.data;
|
||||||
|
|
||||||
if (invite && (DISABLE_INVITES || !emailEnabled)) {
|
if (invite && (!stripeEnabled || !emailEnabled)) {
|
||||||
return { response: "You are not authorized to invite users.", status: 401 };
|
return { response: "You are not authorized to invite users.", status: 401 };
|
||||||
} else if (invite && !parentUser) {
|
} else if (invite && !parentUser) {
|
||||||
return { response: "You must be logged in to invite users.", status: 401 };
|
return { response: "You must be logged in to invite users.", status: 401 };
|
||||||
|
|
Ŝarĝante…
Reference in New Issue