Throw error
parent
fc43e8544a
commit
c1e63bcbda
|
@ -6,6 +6,7 @@ import { hashPassword } from "@calcom/features/auth/lib/hashPassword";
|
||||||
import { sendEmailVerification } from "@calcom/features/auth/lib/verifyEmail";
|
import { sendEmailVerification } from "@calcom/features/auth/lib/verifyEmail";
|
||||||
import { WEBAPP_URL } from "@calcom/lib/constants";
|
import { WEBAPP_URL } from "@calcom/lib/constants";
|
||||||
import { getLocaleFromRequest } from "@calcom/lib/getLocaleFromRequest";
|
import { getLocaleFromRequest } from "@calcom/lib/getLocaleFromRequest";
|
||||||
|
import { HttpError } from "@calcom/lib/http-error";
|
||||||
import { createWebUser as syncServicesCreateWebUser } from "@calcom/lib/sync/SyncServiceManager";
|
import { createWebUser as syncServicesCreateWebUser } from "@calcom/lib/sync/SyncServiceManager";
|
||||||
import { closeComUpsertTeamUser } from "@calcom/lib/sync/SyncServiceManager";
|
import { closeComUpsertTeamUser } from "@calcom/lib/sync/SyncServiceManager";
|
||||||
import { validateUsername } from "@calcom/lib/validateUsername";
|
import { validateUsername } from "@calcom/lib/validateUsername";
|
||||||
|
@ -39,8 +40,10 @@ async function handler(req: RequestWithUsernameStatus, res: NextApiResponse) {
|
||||||
|
|
||||||
// Validate the user
|
// Validate the user
|
||||||
if (!username) {
|
if (!username) {
|
||||||
res.status(422).json({ message: "Invalid username" });
|
throw new HttpError({
|
||||||
return;
|
statusCode: 422,
|
||||||
|
message: "Invalid username",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const email = _email.toLowerCase();
|
const email = _email.toLowerCase();
|
||||||
|
|
Loading…
Reference in New Issue