Skip to content

Commit

Permalink
[Bug] Register | Tenant SMTP blocks new users to register (developmen…
Browse files Browse the repository at this point in the history
…t environment) (#2753)

* fix: error handling on user registration

* refact: using if check for SMTP error handlers
  • Loading branch information
GloireMutaliko21 authored Jul 18, 2024
1 parent 0689967 commit f10226f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions apps/web/app/api/auth/register/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '@app/services/server/requests';
import { setAuthCookies } from '@app/helpers/cookies';
import { recaptchaVerification } from '@app/services/server/recaptcha';
import { RECAPTCHA_SECRET_KEY, VERIFY_EMAIL_CALLBACK_PATH } from '@app/constants';
import { RECAPTCHA_SECRET_KEY, SMTP_PASSWORD, SMTP_USERNAME, VERIFY_EMAIL_CALLBACK_PATH } from '@app/constants';
import { NextResponse } from 'next/server';

export async function POST(req: Request) {
Expand Down Expand Up @@ -84,10 +84,12 @@ export async function POST(req: Request) {
const { data: tenant } = await createTenantRequest(body.team, auth_token);

// Create tenant SMTP
await createTenantSmtpRequest({
access_token: auth_token,
tenantId: tenant.id
});
if (SMTP_USERNAME && SMTP_PASSWORD) {
await createTenantSmtpRequest({
access_token: auth_token,
tenantId: tenant.id
});
}

// Create user organization
const { data: organization } = await createOrganizationRequest(
Expand Down

0 comments on commit f10226f

Please sign in to comment.