* Verify - inital email commit * Add token type - api redirect - migration * Redirect and valid api callback route * Update email design * Change signup URL to redirect to verify-email * Add feature flag - add a11y text to email - add top banner * Shell shouldnt redirect to onboarding if the user needs to verify account * Move flag check to server * Cleanup * Rate limit * Fix redirects * Remove api signup mess * Double negation for forced bool * Fix props * Update packages/emails/templates/account-verify-email.ts * Enable migration by default * Fix typos * Fix google verify issue * Update packages/features/auth/lib/verifyEmail.ts Co-authored-by: Hariom Balhara <hariombalhara@gmail.com> * NITS: @harioms addressed * Remove schema changes * Fix NITs+ improvments * Update apps/web/pages/api/auth/verify-email.ts Co-authored-by: Omar López <zomars@me.com> * Update packages/features/ee/common/components/LicenseRequired.tsx Co-authored-by: Omar López <zomars@me.com> * Update apps/web/pages/api/auth/verify-email.ts Co-authored-by: Omar López <zomars@me.com> * Always preloads feature flags * Update verifyEmail.ts * Update schema.prisma * Type fix --------- Co-authored-by: Hariom Balhara <hariombalhara@gmail.com> Co-authored-by: Omar López <zomars@me.com>
31 lines
729 B
TypeScript
31 lines
729 B
TypeScript
import { sendEmailVerification } from "@calcom/features/auth/lib/verifyEmail";
|
|
import logger from "@calcom/lib/logger";
|
|
|
|
import type { TrpcSessionUser } from "../../../trpc";
|
|
|
|
type ResendEmailOptions = {
|
|
ctx: {
|
|
user: NonNullable<TrpcSessionUser>;
|
|
};
|
|
};
|
|
|
|
const log = logger.getChildLogger({ prefix: [`[[Auth] `] });
|
|
|
|
export const resendVerifyEmail = async ({ ctx }: ResendEmailOptions) => {
|
|
if (ctx.user.emailVerified) {
|
|
log.info(`User ${ctx.user.id} already verified email`);
|
|
return {
|
|
ok: true,
|
|
skipped: true,
|
|
};
|
|
}
|
|
|
|
const email = await sendEmailVerification({
|
|
email: ctx.user.email,
|
|
username: ctx.user?.username ?? undefined,
|
|
language: ctx.user.locale,
|
|
});
|
|
|
|
return email;
|
|
};
|