diff --git a/app.js b/app.js index 926be77..831e82d 100644 --- a/app.js +++ b/app.js @@ -54,9 +54,12 @@ app.get('/', (req, res) => { }); app.get('/signup', (req, res) => { + let error = req.session.errMessage; + delete req.session.errMessage; + const ignore = ["User not found", "Incorrect password"]; - if (ignore.includes(req.session.errMessage)) req.session.errMessage = ""; - res.render('signup', { errMessage: req.session.errMessage }); + if (ignore.includes(error)) error = ""; + res.render('signup', { errMessage: error }); return res.status(status.Ok); }); diff --git a/src/auth/forgotPass.js b/src/auth/forgotPass.js index 424c633..fa97700 100644 --- a/src/auth/forgotPass.js +++ b/src/auth/forgotPass.js @@ -2,8 +2,9 @@ const express = require('express'); const crypto = require('crypto'); const joi = require('joi'); const nodeMail = require('nodemailer'); -const bcrypt = require('bcrypt'); +const path = require('path'); require('dotenv').config(); +const PATH = path.join(__dirname, '..', 'public', 'images', 'wallet.png'); const PORT = process.env.PORT; @@ -40,7 +41,7 @@ module.exports = (users) => { const token = crypto.randomBytes(32).toString('hex'); console.log(`The reset token is ${token}`) - const expiration = Date.now() + 360000; + const expiration = Date.now() + 3600000; await users.updateOne({ email }, { $set: { resetToken: token, resetTokenExpires: expiration } @@ -52,8 +53,13 @@ module.exports = (users) => { from: process.env.EMAIL_USER, to: email, subject: 'Password reset', - text: `reset your password here ${resetUrl} this link will expire within 1 hour`, - + text: `reset your password here ${resetUrl} this link will expire within 1 hour, \n Do not share this link with anyone + \n \n Thankyou, The RCalculator team.`, + html: ` +

Reset your password here. This link will expire in 1 hour.

+

wallet icon

+

Thank you,
The RCalculator team

`, + }; try { diff --git a/src/views/dashboard.ejs b/src/views/dashboard.ejs index d306208..151341f 100644 --- a/src/views/dashboard.ejs +++ b/src/views/dashboard.ejs @@ -13,9 +13,26 @@
- <% plans.forEach(plan=> { %> + <% if (plans.length === 0) { %> +
+
+

Don't have any retirement plans?

+
+
+ Make one +
+
+
+
+ + <% } else %> + <% plans.forEach(plan=> { %> <%- include('./partials/dashboardBox.ejs', {thing: plan}) %> - <% }); %> + <% }); %> +
diff --git a/src/views/partials/dashboardBox.ejs b/src/views/partials/dashboardBox.ejs index 6e9fc0c..29f4b1c 100644 --- a/src/views/partials/dashboardBox.ejs +++ b/src/views/partials/dashboardBox.ejs @@ -5,10 +5,10 @@ class="relative flex flex-col bg-white text-gray-700 shadow-md rounded-xl w-full h-full overflow-hidden min-h-[175px]">
-

+

<%= thing.name %>

-

+

<%= thing.retirementAssets %>

@@ -17,7 +17,7 @@
-

+

Progress: