chore: change identifier (#18518)
Co-authored-by: Bailey Pumfleet <bailey@pumfleet.co.uk>
This commit is contained in:
1 parent
eba335c903
commit
8a8c870513
2 files changed
+7
-4
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import type { GetServerSidePropsContext, NextApiResponse } from "next";
|
||||
|
||||
import { sendEmailVerification } from "@calcom/features/auth/lib/verifyEmail";
|
||||
import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { TrpcSessionUser } from "@calcom/trpc/server/trpc";
|
||||
|
||||
@@ -19,6 +20,11 @@ type AddSecondaryEmailOptions = {
|
||||
export const addSecondaryEmailHandler = async ({ ctx, input }: AddSecondaryEmailOptions) => {
|
||||
const { user } = ctx;
|
||||
|
||||
await checkRateLimitAndThrowError({
|
||||
rateLimitingType: "core",
|
||||
identifier: `addSecondaryEmail.${user.email}`,
|
||||
});
|
||||
|
||||
const existingPrimaryEmail = await prisma.user.findUnique({
|
||||
where: {
|
||||
email: input.email,
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import type { NextApiRequest } from "next";
|
||||
|
||||
import { sendEmailVerification } from "@calcom/features/auth/lib/verifyEmail";
|
||||
import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError";
|
||||
import getIP from "@calcom/lib/getIP";
|
||||
import logger from "@calcom/lib/logger";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import { TRPCError } from "@calcom/trpc/server";
|
||||
@@ -23,7 +20,7 @@ const log = logger.getSubLogger({ prefix: [`[[Auth] `] });
|
||||
|
||||
export const resendVerifyEmail = async ({ input, ctx }: ResendEmailOptions) => {
|
||||
let emailToVerify = ctx.user.email;
|
||||
const identifer = ctx.req ? getIP(ctx.req as NextApiRequest) : emailToVerify;
|
||||
const identifer = emailToVerify;
|
||||
|
||||
await checkRateLimitAndThrowError({
|
||||
rateLimitingType: "core",
|
||||
|
||||
Reference in new issue
Block a user