Password Rest update

This commit is contained in:
=bhagwanSingh 2025-12-16 19:25:41 +05:30
parent 320d44f4b5
commit dba68ed584
1 changed files with 13 additions and 7 deletions

View File

@ -3,6 +3,7 @@ import bcrypt from "bcrypt";
import { VAModel, ClientModel } from "../models/vaModel.js";
import logger from "../config/logger.js";
import axios from "axios";
import authFetch from "../utils/authFetch.js";
class PasswordResetService {
constructor(passwordResetRepository) {
@ -169,14 +170,19 @@ class PasswordResetService {
try {
const userTypeText = userType === 'va' ? 'VA' : 'CLIENT';
await axios.post(`${process.env.SF_DOCTRACKER_API_URL}services/apexrest/docva/api/forgot-password`, {
const res = await authFetch(`${process.env.SF_DOCTRACKER_API_URL}services/apexrest/docva/api/forgot-password`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
data: {
email: email,
url: resetLink,
userType: userTypeText
}
})
});
} catch (error) {
logger.error(`PasswordReset Service - sendResetEmail error for ${userType}: ${error.message}`);
throw new Error("Failed to send reset email");