Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 27 additions & 25 deletions backend/src/services/EmailTransporter.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
import nodemailer from 'nodemailer';

// Check if email credentials are configured
const EMAIL_USER = process.env.EMAIL_USER;
const EMAIL_PASSWORD = process.env.EMAIL_PASSWORD;
const emailConfigured = EMAIL_USER && EMAIL_PASSWORD;

// Log environment variable status for debugging
console.log('Environment variables for email transporter:', {
EMAIL_USER_SET: !!process.env.EMAIL_USER,
EMAIL_PASSWORD_SET: !!process.env.EMAIL_PASSWORD,
});
console.log('Email configuration status:', emailConfigured ? 'Configured' : 'Not configured (email features disabled)');

// Create a transporter object using SMTP transport
const transporter = nodemailer.createTransport({
service: 'gmail', // You can use other services like 'outlook', 'yahoo', etc.
auth: {
user: process.env.EMAIL_USER, // Your email address
pass: process.env.EMAIL_PASSWORD // Your email password or app-specific password
}
});
let transporter = null;

// Verify transporter configuration
transporter.verify((error, success) => {
if (error) {
console.error('Email configuration error:', error);
console.error('Error details:', {
code: error.code,
command: error.command,
stack: error.stack
});
} else {
console.log('Email server is ready to send messages');
}
});
if (emailConfigured) {
// Create a transporter object using SMTP transport
transporter = nodemailer.createTransport({
service: 'gmail', // You can use other services like 'outlook', 'yahoo', etc.
auth: {
user: EMAIL_USER, // Your email address
pass: EMAIL_PASSWORD // Your email password or app-specific password
}
});

// Verify transporter configuration
transporter.verify((error, success) => {
if (error) {
console.error('Email configuration error:', error.message);
} else {
console.log('Email server is ready to send messages');
}
});
} else {
console.log('⚠️ Email is disabled. Set EMAIL_USER and EMAIL_PASSWORD in .env to enable.');
}

export default transporter;
10 changes: 10 additions & 0 deletions backend/src/services/emailService.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import transporter from './EmailTransporter.js';
* @param {string} fullName - User's full name
*/
export const sendVerificationEmail = async (email, token, fullName = 'User') => {
if (!transporter) {
console.warn('Email is disabled. Skipping verification email to:', email);
return;
}

try {
const verificationLink = `${process.env.FRONTEND_URL}/verify-email/${token}`;
const emailTemplate = VerifyAccountEmail(fullName, verificationLink);
Expand All @@ -34,6 +39,11 @@ export const sendVerificationEmail = async (email, token, fullName = 'User') =>
* @param {string} fullName - User's full name (optional)
*/
export const sendPasswordResetEmail = async (email, token, fullName = 'User') => {
if (!transporter) {
console.warn('Email is disabled. Skipping password reset email to:', email);
return;
}

try {
const resetLink = `${process.env.FRONTEND_URL}/reset-password/${token}`;
const emailTemplate = ForgotPasswordEmail(fullName, resetLink);
Expand Down
66 changes: 8 additions & 58 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,34 +69,15 @@
<style>
body {
margin: 0;
padding: 0;
font-family: 'Poppins', sans-serif;
background: linear-gradient(-45deg, #1d1f20, #2e2f31, #3b82f6, #9333ea);
background-size: 400% 400%;
animation: gradientBG 12s ease infinite;
color: white;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.8s ease, color 0.5s ease;
}

@keyframes gradientBG {
0% {background-position: 0% 50%;}
50% {background-position: 100% 50%;}
100% {background-position: 0% 50%;}
width: 100%;
}

#root {
width: 90%;
max-width: 1200px;
min-height: 80vh;
padding: 2rem;
background: rgba(255, 255, 255, 0.08);
backdrop-filter: blur(12px);
border-radius: 20px;
box-shadow: 0 8px 32px rgba(0,0,0,0.3);
animation: fadeIn 1.2s ease;
width: 100%;
min-height: 100vh;
}

@keyframes fadeIn {
Expand All @@ -105,44 +86,13 @@
}

[data-theme="light"] body {
background: linear-gradient(-45deg, #f5f5f5, #e5e7eb, #93c5fd, #c084fc);
background: #f5f5f5;
color: #111;
}

#themeToggle, #scrollTopBtn {
position: fixed;
bottom: 20px;
right: 20px;
background: rgba(255,255,255,0.15);
border: none;
border-radius: 50%;
width: 45px;
height: 45px;
color: #fff;
cursor: pointer;
font-size: 20px;
box-shadow: 0 4px 15px rgba(0,0,0,0.4);
transition: transform 0.3s ease, background 0.3s ease;
}

#themeToggle:hover, #scrollTopBtn:hover {
transform: scale(1.1);
background: rgba(255,255,255,0.25);
}

#scrollTopBtn {
bottom: 80px;
display: none;
}

#google_translate_element {
position: fixed;
top: 10px;
right: 10px;
z-index: 9999;
background: rgba(0,0,0,0.4);
border-radius: 8px;
padding: 5px;
/* Hide default theme and scroll buttons - app has its own */
#themeToggle, #scrollTopBtn, #google_translate_element {
display: none !important;
}

*:focus {
Expand Down
Loading
Loading