Skip to content

Commit

Permalink
chore: change identifier (calcom#18518)
Browse files Browse the repository at this point in the history
Co-authored-by: Bailey Pumfleet <bailey@pumfleet.co.uk>
  • Loading branch information
2 people authored and MuhammadAimanSulaiman committed Feb 25, 2025
1 parent 9be8503 commit e6ea19f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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",
Expand Down

0 comments on commit e6ea19f

Please sign in to comment.