email refactor
This commit is contained in:
@@ -3,7 +3,7 @@ const jwt = require("jsonwebtoken");
|
||||
const { OAuth2Client } = require("google-auth-library");
|
||||
const { User, AlphaInvitation } = require("../models"); // Import from models/index.js to get models with associations
|
||||
const logger = require("../utils/logger");
|
||||
const emailService = require("../services/emailService");
|
||||
const emailServices = require("../services/email");
|
||||
const crypto = require("crypto");
|
||||
|
||||
const {
|
||||
@@ -117,7 +117,7 @@ router.post(
|
||||
// Send verification email (don't block registration if email fails)
|
||||
let verificationEmailSent = false;
|
||||
try {
|
||||
await emailService.sendVerificationEmail(user, user.verificationToken);
|
||||
await emailServices.auth.sendVerificationEmail(user, user.verificationToken);
|
||||
verificationEmailSent = true;
|
||||
} catch (emailError) {
|
||||
const reqLogger = logger.withRequestId(req.id);
|
||||
@@ -558,7 +558,7 @@ router.post(
|
||||
|
||||
// Send verification email
|
||||
try {
|
||||
await emailService.sendVerificationEmail(user, user.verificationToken);
|
||||
await emailServices.auth.sendVerificationEmail(user, user.verificationToken);
|
||||
} catch (emailError) {
|
||||
const reqLogger = logger.withRequestId(req.id);
|
||||
reqLogger.error("Failed to resend verification email", {
|
||||
@@ -726,7 +726,7 @@ router.post(
|
||||
|
||||
// Send password reset email
|
||||
try {
|
||||
await emailService.sendPasswordResetEmail(user, resetToken);
|
||||
await emailServices.auth.sendPasswordResetEmail(user, resetToken);
|
||||
|
||||
const reqLogger = logger.withRequestId(req.id);
|
||||
reqLogger.info("Password reset email sent", {
|
||||
@@ -868,7 +868,7 @@ router.post(
|
||||
|
||||
// Send password changed notification email
|
||||
try {
|
||||
await emailService.sendPasswordChangedEmail(user);
|
||||
await emailServices.auth.sendPasswordChangedEmail(user);
|
||||
const reqLogger = logger.withRequestId(req.id);
|
||||
reqLogger.info("Password changed notification sent", {
|
||||
userId: user.id,
|
||||
|
||||
Reference in New Issue
Block a user