Skip to content

Commit 7f71b43

Browse files
authored
fix: prevent sending an invite email if not enabled (#176)
this updates the invite email sending function to prevent sending an invite email if the environment flag is not set. this matches the behavior with the frontend and prevents malicious actors from bypassing the logic fixes #174
1 parent dbdfc4c commit 7f71b43

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/server/mailer.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ export async function sendSignUpEmail(email: string, token: string, url: string)
5252
}
5353

5454
export async function sendInviteEmail(email: string, name: string) {
55+
if (!env.ENABLE_SENDING_INVITES) {
56+
throw new Error("Sending invites is not enabled")
57+
}
58+
5559
const { host } = new URL(env.NEXTAUTH_URL);
5660

5761
if (env.NODE_ENV === 'development') {

0 commit comments

Comments
 (0)