correction responsive

This commit is contained in:
2026-05-12 20:32:00 +02:00
parent bd6380b7aa
commit eb43d65280
4 changed files with 42 additions and 4 deletions

View File

@@ -75,7 +75,7 @@ export async function scheduleUserDeletion(userId: string, reason: string, delay
// Send notification email
if (settings?.deleteAccountTemplate) {
const { sendEmail } = await import("@/../../lib/mail");
const { sendEmail } = await import("@/lib/mail");
const html = settings.deleteAccountTemplate
.replace(/{name}/g, user.name)
.replace(/{siteName}/g, settings.siteName)
@@ -114,7 +114,7 @@ export async function reactivateUser(userId: string, reason: string) {
// Send confirmation email
if (settings?.reactivateAccountTemplate) {
const { sendEmail } = await import("@/../../lib/mail");
const { sendEmail } = await import("@/lib/mail");
const html = settings.reactivateAccountTemplate
.replace(/{name}/g, user.name)
.replace(/{siteName}/g, settings.siteName)

38
admin/src/lib/mail.ts Normal file
View File

@@ -0,0 +1,38 @@
import nodemailer from 'nodemailer';
console.log('SMTP Config:', {
host: process.env.SMTP_HOST,
port: process.env.SMTP_PORT,
secure: process.env.SMTP_SECURE,
user: process.env.SMTP_USER
});
const transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST,
port: parseInt(process.env.SMTP_PORT || '587'),
secure: process.env.SMTP_SECURE === 'true',
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS,
},
tls: {
rejectUnauthorized: false
}
});
export const sendEmail = async ({ to, subject, html }: { to: string; subject: string; html: string }) => {
const mailOptions = {
from: process.env.SMTP_FROM || '"Afrohub" <noreply@afrohub.com>',
to,
subject,
html,
};
try {
const info = await transporter.sendMail(mailOptions);
console.log('Email sent: ' + info.response);
return info;
} catch (error) {
console.error('Error sending email:', error);
throw error;
}
};

View File

@@ -30,7 +30,7 @@ export async function reactivateUserAccount(userId: string, reason: string) {
// Optionnel : Envoyer un mail de confirmation
const settings = await prisma.siteSetting.findUnique({ where: { id: "singleton" } });
if (settings?.reactivateAccountTemplate) {
const { sendEmail } = await import("@/../lib/mail");
const { sendEmail } = await import("@/lib/mail");
const html = settings.reactivateAccountTemplate
.replace(/{name}/g, user.name)
.replace(/{siteName}/g, settings.siteName)

2
next-env.d.ts vendored
View File

@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/dev/types/routes.d.ts";
import "./.next/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.