fix: allow member invites when signup is disabled (#121)

This commit is contained in:
Henry
2025-07-20 11:18:19 +01:00
committed by GitHub
parent 1305c55100
commit 0cb69e2087
2 changed files with 26 additions and 2 deletions

View File

@@ -166,9 +166,19 @@ export const initAuth = (db: dbClient) => {
databaseHooks: {
user: {
create: {
before() {
async before(user) {
if (env("NEXT_PUBLIC_DISABLE_SIGN_UP")?.toLowerCase() === "true") {
return Promise.resolve(false);
const pendingInvitation = await memberRepo.getByEmailAndStatus(
db,
user.email,
"invited",
);
if (!pendingInvitation) {
return Promise.resolve(false);
}
return Promise.resolve(true);
}
return Promise.resolve(true);
},