Password Reset on register
This commit is contained in:
parent
fc821c70ca
commit
9a811e6f00
|
|
@ -577,7 +577,7 @@ body {
|
||||||
.data-table tbody tr {
|
.data-table tbody tr {
|
||||||
border-bottom: 1px solid var(--border-color);
|
border-bottom: 1px solid var(--border-color);
|
||||||
transition: background-color 0.2s;
|
transition: background-color 0.2s;
|
||||||
cursor: pointer;
|
/* cursor: pointer; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.data-table tbody tr:hover {
|
.data-table tbody tr:hover {
|
||||||
|
|
@ -1689,3 +1689,23 @@ tr[data-vaid]:hover {
|
||||||
[data-theme="dark"] .loading {
|
[data-theme="dark"] .loading {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.va-action {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #fff;
|
||||||
|
background-color: #2563eb;
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 5px;
|
||||||
|
transform: scale(0.96);
|
||||||
|
transition: all 0.2s ease-in-out;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.va-info {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.va-action:hover {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
|
@ -2,9 +2,22 @@ import VaClientRepository from "../../repository/vaClient.repository.js";
|
||||||
import VaClientService from "../../services/vaClient.service.js";
|
import VaClientService from "../../services/vaClient.service.js";
|
||||||
import logger from "../../config/logger.js";
|
import logger from "../../config/logger.js";
|
||||||
import jwt from "jsonwebtoken";
|
import jwt from "jsonwebtoken";
|
||||||
|
import PasswordResetService from "../../services/passwordReset.service.js";
|
||||||
|
import PasswordResetRepository from "../../repository/passwordReset.repository.js";
|
||||||
|
|
||||||
|
|
||||||
const vaClientService = new VaClientService(new VaClientRepository());
|
const vaClientService = new VaClientService(new VaClientRepository());
|
||||||
|
|
||||||
|
const passwordResetService = new PasswordResetService(
|
||||||
|
new PasswordResetRepository(),
|
||||||
|
// new EmailService({
|
||||||
|
// host: process.env.SMTP_HOST,
|
||||||
|
// port: process.env.SMTP_PORT,
|
||||||
|
// user: process.env.SMTP_USER,
|
||||||
|
// pass: process.env.SMTP_PASS,
|
||||||
|
// from: process.env.EMAIL_FROM,
|
||||||
|
// })
|
||||||
|
);
|
||||||
|
|
||||||
async function va_register_client(req, res) {
|
async function va_register_client(req, res) {
|
||||||
logger.info("ClientController - Register Client Hit ...");
|
logger.info("ClientController - Register Client Hit ...");
|
||||||
|
|
@ -23,7 +36,7 @@ async function va_register_client(req, res) {
|
||||||
|
|
||||||
logger.info(`ClientController - Client registered successfully: ${userDetails.email}`);
|
logger.info(`ClientController - Client registered successfully: ${userDetails.email}`);
|
||||||
await passwordResetService.requestPasswordReset(userDetails.email, 'client');
|
await passwordResetService.requestPasswordReset(userDetails.email, 'client');
|
||||||
logger.info(`Client password reset requested for: ${email}`);
|
logger.info(`Client password reset requested for: ${userDetails.email}`);
|
||||||
|
|
||||||
return res.status(201).json({
|
return res.status(201).json({
|
||||||
success: true,
|
success: true,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en" data-theme="light">
|
<html lang="en" data-theme="light">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
@ -7,6 +8,7 @@
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||||||
<link rel="stylesheet" href="/public/css/dashboard.css">
|
<link rel="stylesheet" href="/public/css/dashboard.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="dashboard-body">
|
<body class="dashboard-body">
|
||||||
<div id="root">
|
<div id="root">
|
||||||
<nav class="dashboard-header">
|
<nav class="dashboard-header">
|
||||||
|
|
@ -122,7 +124,8 @@
|
||||||
<!-- Virtual Assistants List -->
|
<!-- Virtual Assistants List -->
|
||||||
<div class="content-section">
|
<div class="content-section">
|
||||||
<div class="section-header" style="justify-content: space-between;align-items: center;">
|
<div class="section-header" style="justify-content: space-between;align-items: center;">
|
||||||
<h2 class="section-title">Virtual Assistants <span class="total-count" id="vaListCount">0 VAs</span></h2>
|
<h2 class="section-title">Virtual Assistants <span class="total-count" id="vaListCount">0
|
||||||
|
VAs</span></h2>
|
||||||
<a href="/client/virtual-assistants/manage-tips" class="btn btn-primary">Manage Tips</a>
|
<a href="/client/virtual-assistants/manage-tips" class="btn btn-primary">Manage Tips</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
|
|
@ -155,6 +158,8 @@
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- VA Modal Start -->
|
||||||
<div id="vaModal" class="modal-overlay">
|
<div id="vaModal" class="modal-overlay">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header" style="display: flex;align-items: center;justify-content: space-between;">
|
<div class="modal-header" style="display: flex;align-items: center;justify-content: space-between;">
|
||||||
|
|
@ -204,6 +209,62 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- VA Modal Start -->
|
||||||
|
|
||||||
|
<!-- Log Modal Start -->
|
||||||
|
<div id="vaModal" class="modal-overlay">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header" style="display: flex;align-items: center;justify-content: space-between;">
|
||||||
|
<h2 class="modal-title" id="modalVAName">VA Details</h2>
|
||||||
|
<button class="modal-close" onclick="closeVAModal()">
|
||||||
|
<i class="fas fa-times"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<!-- Projects Section -->
|
||||||
|
<div class="va-details-section">
|
||||||
|
<!-- <h3 class="va-section-title">
|
||||||
|
<i class="fas fa-briefcase"></i>
|
||||||
|
Projects
|
||||||
|
<span class="va-count-badge" id="projectsCountBadge">0</span>
|
||||||
|
</h3> -->
|
||||||
|
|
||||||
|
<div class="va-table-container">
|
||||||
|
<table class="va-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th>Title</th>
|
||||||
|
<th>Time</th>
|
||||||
|
<th>Duration</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="modalProjectsTableBody">
|
||||||
|
<!-- Project details will be loaded here -->
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div id="modalNoProjects" class="no-vas-message" style="display: none;">
|
||||||
|
<i class="fas fa-briefcase"></i>
|
||||||
|
<h4>No Logs Found</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Action Button -->
|
||||||
|
<div class="modal-actions" id="modalActions" style="display: none;">
|
||||||
|
<a href="#" class="view-session-btn" id="viewSessionBtn" target="_blank">
|
||||||
|
<i class="fas fa-eye"></i>
|
||||||
|
View Live Session
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Log Modal End -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="logoutModal" class="modal-overlay">
|
<div id="logoutModal" class="modal-overlay">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
|
@ -218,7 +279,8 @@
|
||||||
<i class="fas fa-sign-out-alt"></i>
|
<i class="fas fa-sign-out-alt"></i>
|
||||||
</div>
|
</div>
|
||||||
<h3 class="logout-title">Are you sure you want to logout?</h3>
|
<h3 class="logout-title">Are you sure you want to logout?</h3>
|
||||||
<p class="logout-message">You will be logged out of your account and redirected to the login page.</p>
|
<p class="logout-message">You will be logged out of your account and redirected to the login page.
|
||||||
|
</p>
|
||||||
<div class="logout-actions">
|
<div class="logout-actions">
|
||||||
<button class="logout-cancel-btn" onclick="closeLogoutModal()">Cancel</button>
|
<button class="logout-cancel-btn" onclick="closeLogoutModal()">Cancel</button>
|
||||||
<button class="logout-confirm-btn" id="confirmLogoutBtn">Yes, Logout</button>
|
<button class="logout-confirm-btn" id="confirmLogoutBtn">Yes, Logout</button>
|
||||||
|
|
@ -294,7 +356,7 @@
|
||||||
|
|
||||||
// Format time function
|
// Format time function
|
||||||
function formatTime(seconds) {
|
function formatTime(seconds) {
|
||||||
if (!seconds) return 'No Record Found';
|
if (!seconds) return '-';
|
||||||
|
|
||||||
const hours = Math.floor(seconds / 3600);
|
const hours = Math.floor(seconds / 3600);
|
||||||
const minutes = Math.floor((seconds % 3600) / 60);
|
const minutes = Math.floor((seconds % 3600) / 60);
|
||||||
|
|
@ -386,7 +448,7 @@
|
||||||
const activeProject = va?.lastProject?.name ? va.lastProject.name : '-';
|
const activeProject = va?.lastProject?.name ? va.lastProject.name : '-';
|
||||||
const workedTime = formatTime(va.currentSessionDuration);
|
const workedTime = formatTime(va.currentSessionDuration);
|
||||||
const projectsAssigned = va.projectsAssigned || 0;
|
const projectsAssigned = va.projectsAssigned || 0;
|
||||||
const viewLink = va.isCurrentlyActive ? `<a href="/live/${va.lastProjectId}/${va.id}" class="view-link" data-va-id="${va.id}" target="_blank">Live Tracking</a>` : '';
|
const viewLink = va.isCurrentlyActive ? `<a href="/live/${va.lastProjectId}/${va.id}" class="view-link va-action" data-va-id="${va.id}" target="_blank">Live Tracking</a>` : '<p class="va-logs va-action" data-va-id="${va.id}" target="_blank">Logs</p>';
|
||||||
|
|
||||||
return `
|
return `
|
||||||
<tr class="va-row" data-va-id="${va.id}">
|
<tr class="va-row" data-va-id="${va.id}">
|
||||||
|
|
@ -405,7 +467,7 @@
|
||||||
<span class="projects-count">${activeProject}</span>
|
<span class="projects-count">${activeProject}</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="projects-count">${projectsAssigned} Projects</span>
|
<span class="projects-count">${projectsAssigned}</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="worked-time">${workedTime}</span>
|
<span class="worked-time">${workedTime}</span>
|
||||||
|
|
@ -450,7 +512,7 @@
|
||||||
window.vaData = allVAs;
|
window.vaData = allVAs;
|
||||||
|
|
||||||
// Add click event listeners to VA rows
|
// Add click event listeners to VA rows
|
||||||
document.querySelectorAll('.va-row').forEach((row, index) => {
|
document.querySelectorAll('.va-info').forEach((row, index) => {
|
||||||
row.addEventListener('click', function (e) {
|
row.addEventListener('click', function (e) {
|
||||||
// Don't open modal if clicking on view link
|
// Don't open modal if clicking on view link
|
||||||
if (!e.target.closest('.view-link')) {
|
if (!e.target.closest('.view-link')) {
|
||||||
|
|
@ -522,6 +584,12 @@
|
||||||
document.body.style.overflow = 'auto';
|
document.body.style.overflow = 'auto';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleVaLogsClick = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
cosnole.log("handleVaLogsClick Called")
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
// Load dashboard data
|
// Load dashboard data
|
||||||
loadDashboardData();
|
loadDashboardData();
|
||||||
|
|
@ -551,8 +619,19 @@
|
||||||
|
|
||||||
// Confirm logout button
|
// Confirm logout button
|
||||||
document.getElementById('confirmLogoutBtn').addEventListener('click', handleLogout);
|
document.getElementById('confirmLogoutBtn').addEventListener('click', handleLogout);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const allVaLogsBtn = document.querySelectorAll(".va-logs");
|
||||||
|
for (const va of allVaLogsBtn) {
|
||||||
|
va.addEventListener("click", handleVaLogsClick)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Loading…
Reference in New Issue