Refactor admin dashboard and fix mobile phone input dropdown
All checks were successful
Build And Push Image / docker (push) Successful in 2m54s

- Simplify admin dashboard by consolidating configuration sections
- Fix mobile dropdown display issues in PhoneInputWrapper component
- Add proper flex layout and minimum height for mobile country list
- Update email configuration and testing functionality
- Remove redundant configuration cards in favor of unified portal settings
This commit is contained in:
2025-08-09 16:05:00 +02:00
parent dcb7840825
commit 8d872f9a04
4 changed files with 109 additions and 132 deletions

View File

@@ -51,16 +51,18 @@ export default defineEventHandler(async (event) => {
const { getEmailService } = await import('~/server/utils/email');
const emailService = await getEmailService();
// Verify connection first
const connectionOk = await emailService.verifyConnection();
if (!connectionOk) {
throw createError({
statusCode: 500,
statusMessage: 'SMTP connection verification failed. Please check your SMTP configuration.'
});
// Try to verify connection but don't fail if verification doesn't work
// Some SMTP servers have issues with verify() but work fine for sending
try {
const connectionOk = await emailService.verifyConnection();
if (connectionOk) {
console.log('[api/admin/test-email.post] SMTP connection verified successfully');
}
} catch (verifyError: any) {
console.warn('[api/admin/test-email.post] SMTP verification failed, attempting to send anyway:', verifyError.message);
}
// Send test email
// Attempt to send test email regardless of verification result
await emailService.sendTestEmail(body.testEmail);
console.log('[api/admin/test-email.post] ✅ Test email sent successfully');

View File

@@ -60,20 +60,67 @@ export class EmailService {
}
try {
this.transporter = nodemailer.createTransport({
// Determine security settings based on port
let useSecure = this.config.secure;
let requireTLS = false;
// Auto-configure based on standard ports if not explicitly set
if (this.config.port === 587) {
// Port 587 typically uses STARTTLS
useSecure = false;
requireTLS = true;
} else if (this.config.port === 465) {
// Port 465 typically uses SSL/TLS
useSecure = true;
requireTLS = false;
} else if (this.config.port === 25) {
// Port 25 typically unencrypted (not recommended)
useSecure = false;
requireTLS = false;
}
// Build transporter options
const transporterOptions: any = {
host: this.config.host,
port: this.config.port,
secure: this.config.secure, // true for 465, false for other ports
auth: this.config.username && this.config.password ? {
secure: useSecure,
// Connection timeout settings
connectionTimeout: 30000, // 30 seconds
greetingTimeout: 30000,
socketTimeout: 30000,
// Debug logging
logger: false,
debug: false
};
// Add requireTLS if needed (for STARTTLS)
if (requireTLS && !useSecure) {
transporterOptions.requireTLS = true;
}
// Configure TLS options
transporterOptions.tls = {
rejectUnauthorized: false, // Accept self-signed certificates
// Don't specify minVersion or ciphers to allow auto-negotiation
};
// Add authentication only if credentials are provided
if (this.config.username && this.config.password) {
transporterOptions.auth = {
user: this.config.username,
pass: this.config.password
} : undefined,
tls: {
rejectUnauthorized: false // Accept self-signed certificates in development
}
});
};
}
console.log('[EmailService] ✅ SMTP transporter initialized');
this.transporter = nodemailer.createTransport(transporterOptions);
console.log('[EmailService] ✅ SMTP transporter initialized with options:', {
host: this.config.host,
port: this.config.port,
secure: transporterOptions.secure,
requireTLS: transporterOptions.requireTLS,
auth: !!transporterOptions.auth
});
} catch (error) {
console.error('[EmailService] ❌ Failed to initialize SMTP transporter:', error);
}