Skip to content

Commit 11f4247

Browse files
authored
Merge pull request #40 from MoaidHashem3/moaid
-Formating the email
2 parents d1bce9a + 8304706 commit 11f4247

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

controllers/handelUser.js

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ const uploadImage = async (req, res) => {
204204

205205
const forgotPassword = async (req, res) => {
206206
const { email } = req.body;
207-
console.log(process.env.EMAIL_USER, process.env.EMAIL_PASS);
208207

209208
if (!email) {
210209
return res.status(400).json({ message: "Email is required" });
@@ -237,11 +236,29 @@ const uploadImage = async (req, res) => {
237236
to: user.email,
238237
239238
subject: 'UMS Password Reset',
240-
text: `You are receiving this because you have requested to reset the password for your account.\n\n
241-
Please click on the following link, or paste it into your browser to complete the process:\n\n
242-
${resetUrl}\n\n
243-
If you did not request this, please ignore this email and your password will remain unchanged.\n
244-
UMS TEAM`,
239+
html: `
240+
<div style="font-family: Arial, sans-serif; background-color: #f4f4f4; padding: 20px; border-radius: 8px;">
241+
<div style="max-width: 600px; margin: auto; background-color: #ffffff; padding: 30px; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);">
242+
<h1 style="color:#808080;">UMS</h1>
243+
<h2 style="color: #333333;">Password Reset Request [Valid for 1 hour]</h2>
244+
<p style="color: #555555;">Dear ${user.name},</p>
245+
<p style="color: #555555;">
246+
You are receiving this email because we received a request to reset the password for your account.
247+
</p>
248+
<p style="color: #555555;">
249+
To complete the process, please click on the link below or copy and paste it into your browser:
250+
</p>
251+
<p>
252+
<a href="${resetUrl}" style="color: #008A90; text-decoration: none; font-weight: bold;">${resetUrl}</a>
253+
</p>
254+
<p style="color: #555555;">
255+
If you did not request this change, please ignore this email. Your password will remain unchanged.
256+
</p>
257+
<p style="color: #555555;">Thank you,</p>
258+
<p style="color: #008A90; font-weight: bold;">UMS Team</p>
259+
</div>
260+
</div>
261+
`
245262
};
246263

247264
transporter.sendMail(mailOptions, (err) => {
@@ -259,7 +276,6 @@ const uploadImage = async (req, res) => {
259276
const resetPassword = async (req, res) => {
260277
const { token } = req.params;
261278
const { password } = req.body;
262-
console.log(password)
263279
if (!password) {
264280
return res.status(400).json({ message: "Password is required" });
265281
}

0 commit comments

Comments
 (0)