Compare commits

...
Author SHA1 Message Date
Joaquin Paredes 79f0caa3c1 Merge pull request #23 from JoaquinPar/dev
End of Sprint 2
2025-05-10 16:35:08 -07:00
Nícolas Agostini 4f73959cfb Merge pull request #22 from JoaquinPar/fix/16-hovering-hides-progress
Progress bar background changed to black to avoid disappearing
2025-05-09 15:54:45 -07:00
nicoagostini 6444d7afa7 Progress bar background changed to black to avoid disappearing 2025-05-09 15:53:40 -07:00
Nícolas Agostini daa984a48f Merge pull request #21 from JoaquinPar/fix/questionnaireFix
Issue 19: Questionnaire more than once, fixed
2025-05-09 14:04:31 -07:00
nicoagostini 383bd15263 Issue 19: Questionnaire more than once, fixed 2025-05-09 14:03:35 -07:00
knighthawk4227 1e44e8ddfb moving resetLink post to forgotpass.js 2025-05-09 11:25:36 -07:00
knighthawk4227 cc875b4e22 Merge branch 'dev' of github.com:JoaquinPar/2800-202510-BBY14 into dev 2025-05-09 11:24:03 -07:00
knighthawk4227 f3dbbebb43 moving resetLink post to forgotpass.js 2025-05-09 11:18:25 -07:00
Joaquin 4ee885ac57 fix/reorganized scripts called in ejs files 2025-05-09 11:06:13 -07:00
knighthawk4227 f3b121fc71 Merge branch 'feature/forgotPass' into dev 2025-05-09 11:03:02 -07:00
knighthawk4227 07824e6355 merge cnflicts with dev 2025-05-09 11:02:31 -07:00
Joaquin 22850ab2a2 fix/removed redundant code and fixed UI challenge 1 problem 2025-05-09 10:55:02 -07:00
SowinskiBraeden 69fd776c0f fix/enhanced user input validation 2025-05-09 10:29:20 -07:00
knighthawk4227 671b67be9d Merge branch 'dev' into feature/forgotPass 2025-05-09 10:27:33 -07:00
knighthawk4227 99b36d3370 fixing conflict with dashboard.ejs 2025-05-09 10:26:18 -07:00
SowinskiBraeden 1f742d41c3 fix/signup using existing email 2025-05-09 10:23:34 -07:00
SowinskiBraeden 18bee21941 Merge branch 'dev' of github.com:JoaquinPar/2800-202510-BBY14 into dev 2025-05-09 10:07:16 -07:00
knighthawk4227 1fcd12c6da fixing merge conflicts 2025-05-09 10:04:24 -07:00
SowinskiBraeden 0a9c176274 fix/default asset icon creation 2025-05-09 10:00:51 -07:00
knighthawk4227 1587f363f7 fixing reset link session 2025-05-09 09:50:38 -07:00
SowinskiBraeden 540e191d27 refactor/remove debug statements 2025-05-09 09:49:14 -07:00
SowinskiBraeden 1e01e022bf Merge pull request #14 from JoaquinPar/feature/asset-select-icon
update+fix/asset icons + load geolocation scripts
2025-05-08 23:32:40 -07:00
knighthawk4227 c64da1de46 fixing conflicts and merging dev 2025-05-08 10:44:38 -07:00
knighthawk4227 7a5d2e7490 fixing conflicts merging dev into this 2025-05-08 10:40:31 -07:00
knighthawk4227 fc39bcf693 nodemailer dependencies 2025-05-08 10:32:10 -07:00
knighthawk4227 29d682c4e8 fixing joi validation 2025-05-07 19:26:00 -07:00
knighthawk4227 15dd4e0d20 forgot password validatation using joi 2025-05-07 19:09:25 -07:00
knighthawk4227 cb59e86d8a fixing merge conflicts and forgot password functionality 2025-05-07 17:44:06 -07:00
knighthawk4227 088f9ea55a reset pass logic 2025-05-07 13:03:26 -07:00
knighthawk4227 617fc8d877 indentation of dashboard 2025-05-07 10:49:08 -07:00
knighthawk4227 f0b1089e15 routes for forgotPass 2025-05-07 00:52:01 -07:00
knighthawk4227 a40b6d514b forgot password js 2025-05-06 23:33:05 -07:00
Joaquin Paredes 5819b0d151 Merge pull request #1 from JoaquinPar/dev
Merging Dev into Main Sprint #0
2025-04-29 16:07:03 -07:00
19 changed files with 318 additions and 40 deletions

No files matched your search

+3
View File
@@ -1,6 +1,9 @@
# Environment variables # Environment variables
.env .env
#vscode files
.vscode
# Node modules # Node modules
node_modules/ node_modules/
+36
View File
@@ -3,6 +3,7 @@ const MongoStore = require("connect-mongo");
const session = require("express-session"); const session = require("express-session");
const express = require('express'); const express = require('express');
const path = require('path'); const path = require('path');
const bcrypt = require('bcrypt');
const joi = require('joi'); const joi = require('joi');
require('dotenv').config(); require('dotenv').config();
@@ -73,6 +74,39 @@ app.get('/aboutUs', (req, res) => {
return res.status(status.Ok); return res.status(status.Ok);
}); });
app.get('/forgotPassword', (req, res) => {
const error = req.session.error;
const reset = req.session.reset;
delete req.session.reset;
delete req.session.error;
res.render('forgotPass', { error: error, reset: reset });
return res.status(status.Ok);
});
// Reset with token given to user via email
app.get('/reset/:token', async (req, res) => {
const token = req.params.token;
const user = await users.findOne({
resetToken: token,
resetTokenExpires: { $gt: Date.now() },
});
if (!user) {
req.session.error = 'reset link not valid or has expired';
return res.redirect('/forgotPassword');
}
const error = req.session.error;
delete req.session.error;
res.render('resetPass', {
token: token,
errMessage: error,
});
});
// 404 handler - keep the actual notFound route please // 404 handler - keep the actual notFound route please
// REALLY DONT DELETE THIS // REALLY DONT DELETE THIS
app.get('/notFound', (req, res) => { app.get('/notFound', (req, res) => {
@@ -86,6 +120,8 @@ initDatabase().then(() => {
// Import authentication handler // Import authentication handler
app.use(require("./src/auth/authentication")(users)); app.use(require("./src/auth/authentication")(users));
app.use(require('./src/auth/forgotPass')(users));
// Import middleware & apply to user routes // Import middleware & apply to user routes
const middleware = require("./src/auth/middleware")(users); const middleware = require("./src/auth/middleware")(users);
+18 -1
View File
@@ -11,12 +11,14 @@
"dependencies": { "dependencies": {
"bcrypt": "^5.1.1", "bcrypt": "^5.1.1",
"connect-mongo": "^5.1.0", "connect-mongo": "^5.1.0",
"crypto": "^1.0.1",
"dotenv": "^16.5.0", "dotenv": "^16.5.0",
"ejs": "^3.1.10", "ejs": "^3.1.10",
"express": "^5.1.0", "express": "^5.1.0",
"express-session": "^1.18.1", "express-session": "^1.18.1",
"joi": "^17.13.3", "joi": "^17.13.3",
"mongodb": "^6.16.0" "mongodb": "^6.16.0",
"nodemailer": "^7.0.3"
}, },
"devDependencies": { "devDependencies": {
"nodemon": "^3.1.10" "nodemon": "^3.1.10"
@@ -483,6 +485,12 @@
"node": ">=6.6.0" "node": ">=6.6.0"
} }
}, },
"node_modules/crypto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz",
"integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==",
"deprecated": "This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in."
},
"node_modules/debug": { "node_modules/debug": {
"version": "4.4.0", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
@@ -1430,6 +1438,15 @@
"webidl-conversions": "^3.0.0" "webidl-conversions": "^3.0.0"
} }
}, },
"node_modules/nodemailer": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-7.0.3.tgz",
"integrity": "sha512-Ajq6Sz1x7cIK3pN6KesGTah+1gnwMnx5gKl3piQlQQE/PwyJ4Mbc8is2psWYxK3RJTVeqsDaCv8ZzXLCDHMTZw==",
"license": "MIT-0",
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/nodemon": { "node_modules/nodemon": {
"version": "3.1.10", "version": "3.1.10",
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.10.tgz", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.10.tgz",
+3 -1
View File
@@ -20,12 +20,14 @@
"dependencies": { "dependencies": {
"bcrypt": "^5.1.1", "bcrypt": "^5.1.1",
"connect-mongo": "^5.1.0", "connect-mongo": "^5.1.0",
"crypto": "^1.0.1",
"dotenv": "^16.5.0", "dotenv": "^16.5.0",
"ejs": "^3.1.10", "ejs": "^3.1.10",
"express": "^5.1.0", "express": "^5.1.0",
"express-session": "^1.18.1", "express-session": "^1.18.1",
"joi": "^17.13.3", "joi": "^17.13.3",
"mongodb": "^6.16.0" "mongodb": "^6.16.0",
"nodemailer": "^7.0.3"
}, },
"devDependencies": { "devDependencies": {
"nodemon": "^3.1.10" "nodemon": "^3.1.10"
+12 -5
View File
@@ -20,7 +20,7 @@ module.exports = (users) => {
const credentialSchema = joi.object({ const credentialSchema = joi.object({
email: joi.string().email().required(), email: joi.string().email().required(),
password: joi.string().max(20).required(), password: joi.string().alphanum().max(20).required(),
}); });
const valid = credentialSchema.validate(req.body); const valid = credentialSchema.validate(req.body);
@@ -56,9 +56,9 @@ module.exports = (users) => {
router.post("/signup", async (req, res) => { router.post("/signup", async (req, res) => {
const userSchema = joi.object({ const userSchema = joi.object({
email: joi.string().email().required(), email: joi.string().email().required(),
name: joi.string().alphanum().max(20).required(), name: joi.string().pattern(new RegExp('^[a-zA-Z]+$')).max(20).required(),
password: joi.string().max(20).min(8).required(), password: joi.string().alphanum().max(20).min(8).required(),
repassword: joi.string().max(20).min(8).required(), repassword: joi.string().alphanum().max(20).min(8).required(),
}); });
const valid = userSchema.validate(req.body); const valid = userSchema.validate(req.body);
@@ -69,6 +69,13 @@ module.exports = (users) => {
return res.redirect("/signup"); return res.redirect("/signup");
} }
let exists = await users.findOne({ email: req.body.email }).then((exists) => exists);
if (exists) {
req.session.errMessage = "Email already in use";
res.status(status.BadRequest);
return res.redirect("/signup");
}
if (req.body.password != req.body.repassword) { if (req.body.password != req.body.repassword) {
req.session.errMessage = "Passwords must match"; req.session.errMessage = "Passwords must match";
res.status(status.BadRequest); res.status(status.BadRequest);
@@ -84,7 +91,7 @@ module.exports = (users) => {
financialData: false, financialData: false,
}).then((results, err) => { }).then((results, err) => {
if (err) { if (err) {
console.error(err); console.error("Error creating user on signup: ", err);
res.session.errMessage = "Internal server error"; res.session.errMessage = "Internal server error";
return res.status(status.InternalServerError).redirect("/signup"); return res.status(status.InternalServerError).redirect("/signup");
} }
+118
View File
@@ -0,0 +1,118 @@
const express = require('express');
const crypto = require('crypto');
const joi = require('joi');
const nodeMail = require('nodemailer');
const bcrypt = require('bcrypt');
require('dotenv').config();
const PORT = process.env.PORT;
const transporter = nodeMail.createTransport({
service: 'gmail',
auth: {
user: process.env.EMAIL_USER,
pass: process.env.EMAIL_PASS,
}
});
// users info
module.exports = (users) => {
const router = express.Router();
router.post('/auth/resetPass', async (req, res) => {
const resetSchema = joi.object({
email: joi.string().email().required(),
});
req.session.error = '';
req.session.reset = '';
const valid = resetSchema.validate(req.body);
if (valid.error) {
req.session.error = 'invalid email';
return res.redirect('/forgotPassword')
}
const { email } = req.body;
const user = await users.findOne({ email });
if (!user) {
req.session.error = 'No user found'
return res.redirect('/forgotPassword');
}
const token = crypto.randomBytes(32).toString('hex');
console.log(`The reset token is ${token}`)
const expiration = Date.now() + 360000;
await users.updateOne({ email }, {
$set: { resetToken: token, resetTokenExpires: expiration }
});
const resetUrl = `http://localhost:${PORT}/reset/${token}`;
const mailSend = {
from: process.env.EMAIL_USER,
to: email,
subject: 'Password reset',
text: `reset your password here ${resetUrl} this link will expire within 1 hour`,
};
try {
await transporter.sendMail(mailSend);
req.session.reset = 'Reset link sent Check your email';
res.redirect('/forgotPassword');
} catch (err) {
console.log('there was an error', err);
res.status(500).send('email failed to send try again');
}
});
router.post('/resetLink', async (req, res) => {
const { token, password, confirmPassword, } = req.body;
const passwordSchema = joi.object({
password: joi.string().max(20).required(),
confirmPassword: joi.string().max(20).required(),
});
const valid = passwordSchema.validate({ password, confirmPassword });
if (valid.error) {
console.log("houston we have a problem");
req.session.error = 'Invalid input';
res.status(status.BadRequest);
return res.redirect(`/reset/${token}`);
}
if (!token || !password || !confirmPassword) {
req.session.error = 'field may be missing';
return res.redirect(`/reset/${token}`);
}
if (password !== confirmPassword) {
req.session.error = 'passwords do not match';
return res.redirect(`/reset/${token}`);
}
const user = await users.findOne({
resetToken: token,
resetTokenExpires: { $gt: Date.now() },
});
if (!user) {
req.session.error = 'Reset link is invalid.';
return res.redirect(`/reset`);
}
const hashPassword = await bcrypt.hash(password, 12);
await users.updateOne(
{
email: user.email
},
{
$set: {
password: hashPassword,
resetToken: '',
resetTokenExpires: 0,
},
}
);
req.session.success = 'Password has been reset';
res.redirect('/login');
});
return router;
}
-2
View File
@@ -37,8 +37,6 @@ function update(data) {
dropdown.appendChild(listItem); dropdown.appendChild(listItem);
}); });
// console.log(data);
} }
function switchButton(clickedButton) { function switchButton(clickedButton) {
+11 -10
View File
@@ -98,9 +98,7 @@ module.exports = (middleware, users, plans, assets) => {
router.get('/plans', async (req, res) => { router.get('/plans', async (req, res) => {
try { try {
// console.log(new ObjectId(req.session.user._id));
const userPlansFromDB = await plans.find({ userId: new ObjectId(req.session.user._id) }).toArray(); const userPlansFromDB = await plans.find({ userId: new ObjectId(req.session.user._id) }).toArray();
// console.log(userPlansFromDB);
// Use a for...of loop for proper async/await behavior in series for updates // Use a for...of loop for proper async/await behavior in series for updates
for (const plan of userPlansFromDB) { for (const plan of userPlansFromDB) {
@@ -142,7 +140,6 @@ module.exports = (middleware, users, plans, assets) => {
req.session.errMessage = "Plan not found or you do not have permission to view it."; req.session.errMessage = "Plan not found or you do not have permission to view it.";
return res.status(status.NotFound).redirect('/plans'); return res.status(status.NotFound).redirect('/plans');
} }
// console.log("Found plan:", plan);
// The plan.progress should be up-to-date from the database as it was updated in the /plans route // The plan.progress should be up-to-date from the database as it was updated in the /plans route
// or when assets/plans are modified. If an immediate recalculation for this specific view is absolutely needed, // or when assets/plans are modified. If an immediate recalculation for this specific view is absolutely needed,
@@ -166,7 +163,7 @@ module.exports = (middleware, users, plans, assets) => {
}); });
router.get('/newPlan', (req, res) => { router.get('/newPlan', (req, res) => {
if(!req.session.user.financialData){ if (!req.session.user.financialData || !req.session.user) {
req.session.errMessage = "Please complete your financial data before creating a plan."; req.session.errMessage = "Please complete your financial data before creating a plan.";
return res.status(status.Unauthorized).redirect('/questionnaire'); return res.status(status.Unauthorized).redirect('/questionnaire');
} }
@@ -255,8 +252,6 @@ module.exports = (middleware, users, plans, assets) => {
}); });
router.post('/questionnaire', (req, res) => { router.post('/questionnaire', (req, res) => {
// console.log("Questionnaire POST body:", req.body);
const questionnaireSchema = joi.object({ const questionnaireSchema = joi.object({
dob: joi.date().required(), dob: joi.date().required(),
education: joi.string().valid('primary', 'secondary', 'tertiary', 'postgraduate').required(), education: joi.string().valid('primary', 'secondary', 'tertiary', 'postgraduate').required(),
@@ -304,7 +299,13 @@ module.exports = (middleware, users, plans, assets) => {
req.session.user.financialData = true; req.session.user.financialData = true;
req.session.errMessage = ""; req.session.errMessage = "";
res.status(status.Ok).redirect("/home");
req.session.save(err => {
if (err) {
res.status(status.InternalServerError).redirect("/plans");
}
res.status(status.Ok).redirect("/plans");
});
}).catch(err => { }).catch(err => {
console.error("Error updating questionnaire in database:", err); console.error("Error updating questionnaire in database:", err);
@@ -316,9 +317,9 @@ module.exports = (middleware, users, plans, assets) => {
router.post("/updateAccount", async (req, res) => { router.post("/updateAccount", async (req, res) => {
const accountSchema = joi.object({ const accountSchema = joi.object({
email: joi.string().email(), email: joi.string().email(),
name: joi.string().alphanum().max(20), name: joi.string().pattern(new RegExp('^[a-zA-Z]+$')).max(20),
password: joi.string().max(20).min(8), password: joi.string().alphanum().max(20).min(8),
repassword: joi.string().max(20).min(8), repassword: joi.string().alphanum().max(20).min(8),
}); });
const valid = accountSchema.validate(req.body); const valid = accountSchema.validate(req.body);
+1 -1
View File
@@ -38,7 +38,7 @@
<!-- Create other asset form --> <!-- Create other asset form -->
<form method="POST" action="/createAsset" id="create-other-asset-form"> <form method="POST" action="/createAsset" id="create-other-asset-form">
<input style="display: none;" id="type" value="other" name="type" type="text"> <input style="display: none;" id="type" value="other" name="type" type="text">
<input style="display: none;" id="icon" value="other" name="icon" type="text"> <input style="display: none;" id="icon" value="Other" name="icon" type="text">
<label for="name" class="block text-sm font-medium text-gray-700 mt-2">Select an Icon</label> <label for="name" class="block text-sm font-medium text-gray-700 mt-2">Select an Icon</label>
<div class="flex items-center"> <div class="flex items-center">
+31 -10
View File
@@ -4,10 +4,20 @@
<main> <main>
<!-- Buttons --> <!-- Buttons -->
<div class="flex justify-end gap-4 px-5 py-6"> <div class="flex justify-end gap-4 px-5 py-6">
<a href="/assets?popup" class="text-center cursor-pointer min-w-[150px] bg-green-600 px-4 py-2 text-white rounded hover:bg-green-800" type="button">Add Asset</a> <a href="/assets?popup"
<a href="/newPlan" class="text-center cursor-pointer min-w-[150px] bg-green-600 px-4 py-2 text-white rounded hover:bg-green-800" type="button">Create new plan </a> class="text-center cursor-pointer min-w-[150px] bg-green-600 px-4 py-2 text-white rounded hover:bg-green-800"
type="button">Add Asset</a>
<a href="/newPlan"
class="text-center cursor-pointer min-w-[150px] bg-green-600 px-4 py-2 text-white rounded hover:bg-green-800"
type="button">Create new plan </a>
</div> </div>
<!--This is the cards for plans and other things--> <!--This is the cards for plans and other things-->
<div class="mt-12">
<!--box to put logo icon if we want on in a box-->
<!-- <div -->
<!-- class="bg-clip-border mx-4 rounded-xl overflow-hidden bg-gradient-to-tr from-blue-600 to-blue-400 text-white shadow-blue-500/40 shadow-lg absolute mt-2 grid h-16 w-16 place-items-center"> -->
<!-- </div> -->
<!--This is the cards for plans and other things-->
<div class="mt-12"> <div class="mt-12">
<div class="mb-12 grid gap-y-10 gap-x-6 md:grid-cols-2 mr-3 ml-3 xl:grid-cols-4"> <div class="mb-12 grid gap-y-10 gap-x-6 md:grid-cols-2 mr-3 ml-3 xl:grid-cols-4">
<!--box to put logo icon if we want on in a box--> <!--box to put logo icon if we want on in a box-->
@@ -23,8 +33,11 @@
$53k</h4> $53k</h4>
</div> </div>
<div class="border-t border-blue-gray-50 p-10"> <div class="border-t border-blue-gray-50 p-10">
<p class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600"> <p
<strong class="text-green-500">Make this percent bar or graph or something </strong>&nbsp;than lastweek class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
<strong class="text-green-500">Make this percent bar or graph or
something
</strong>&nbsp;than lastweek
</p> </p>
</div> </div>
</div> </div>
@@ -37,8 +50,11 @@
$53k</h4> $53k</h4>
</div> </div>
<div class="border-t border-blue-gray-50 p-10"> <div class="border-t border-blue-gray-50 p-10">
<p class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600"> <p
<strong class="text-green-500">Make this percent bar or graph or something </strong>&nbsp;than last class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
<strong class="text-green-500">Make this percent bar or graph or
something
</strong>&nbsp;than last
week week
</p> </p>
</div> </div>
@@ -67,8 +83,10 @@
<!-- </p> --> <!-- </p> -->
<!-- </div> --> <!-- </div> -->
<!-- </div> --> <!-- </div> -->
<div class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md"> <div
<div class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md"> class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
<div
class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
<div class="p-4 flex items-center justify-between"> <div class="p-4 flex items-center justify-between">
<p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600"> <p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600">
Retirement goal</p> Retirement goal</p>
@@ -77,8 +95,11 @@
$53k</h4> $53k</h4>
</div> </div>
<div class="border-t border-blue-gray-50 p-10"> <div class="border-t border-blue-gray-50 p-10">
<p class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600"> <p
<strong class="text-green-500">Make this percent bar or graph or something </strong>&nbsp;than last class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
<strong class="text-green-500">Make this percent bar or
graph or something
</strong>&nbsp;than last
week week
</p> </p>
</div> </div>
+38
View File
@@ -0,0 +1,38 @@
<%- include("./partials/fileHeader") %>
<main>
<div class="flex justify-center items-center h-screen">
<form action="/auth/resetPass" method="POST">
<div class="w-96 p-6 shadow-1g bg-white rounded-md">
<h1 class="text-3xl block text-center font-semibold">Reset Password</h1>
<hr class="mt-3">
<% if (!reset ) { %>
<div class="mt-3">
<label for="email" class="block text-base mb-2">Email</label>
<input type="text" id="email" name="email"
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
placeholder="Enter Email" />
</div>
<% } else { %>
<div class="mt-3">
<h1 class="text-2xl block text-center font-bold text-red-600"> Reset link sent. </h1>
</div>
<% } %>
<!---->
<div class="text-red-800 font-bold" id="forgor">
<%= error%>
</div>
<% if (!reset) { %>
<div class="mt-5">
<button type="submit"
class="cursor-pointer border-2 border-gray-600 bg-blue-600 text-white py-1 w-full rounded-md hover:bg-transparent hover:text-indigo-700 font-semibold">Send
reset Link</button>
</div>
<% } %>
</div>
</form>
</div>
</main>
<%- include("./partials/footer") %> <%- include("./partials/footer") %>
+1 -1
View File
@@ -25,7 +25,7 @@
<label>Remember me</label> <label>Remember me</label>
</div> </div>
<div> <div>
<a href="#" class="text-indigo-600 font-semibold">Forgot Password? </a> <a href="/forgotPassword" class="text-indigo-600 font-semibold">Forgot Password? </a>
</div> </div>
</div> </div>
<div class="mt-5"> <div class="mt-5">
+2
View File
@@ -7,5 +7,7 @@
</div> </div>
</footer> </footer>
<script src="https://cdn.jsdelivr.net/npm/flowbite@3.1.2/dist/flowbite.min.js"></script>
</body> </body>
</html> </html>
+2 -2
View File
@@ -22,7 +22,7 @@
<p id="flagTag"></p> <p id="flagTag"></p>
</div> </div>
<div class="relative w-full"> <div class="relative w-full">
<p id="exchange" class="block text-center p-2.5 w-30 z-20 text-sm text-gray-900 bg-gray-50 border-s-0 border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-s-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:border-blue-500"> <p id="exchange" class="block text-center p-2.5 w-40 z-20 text-sm text-gray-900 bg-gray-50 border-s-0 border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-s-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:border-blue-500">
</p> </p>
</div> </div>
<button id="dropdown-country-button" value="" data-dropdown-toggle="dropdown-country" class="shrink-0 z-10 inline-flex items-center py-2.5 px-4 text-sm font-medium text-center text-gray-900 bg-gray-100 border border-gray-300 rounded-e-lg hover:bg-gray-200 focus:ring-4 focus:outline-none focus:ring-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 dark:focus:ring-gray-700 dark:text-white dark:border-gray-600" type="button"> <button id="dropdown-country-button" value="" data-dropdown-toggle="dropdown-country" class="shrink-0 z-10 inline-flex items-center py-2.5 px-4 text-sm font-medium text-center text-gray-900 bg-gray-100 border border-gray-300 rounded-e-lg hover:bg-gray-200 focus:ring-4 focus:outline-none focus:ring-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 dark:focus:ring-gray-700 dark:text-white dark:border-gray-600" type="button">
@@ -45,7 +45,7 @@
<p id="flagTag"></p> <p id="flagTag"></p>
</div> </div>
<div class="relative w-full"> <div class="relative w-full">
<p id="exchange" class="block text-center p-2.5 w-30 z-20 text-sm text-gray-900 bg-gray-50 border-s-0 border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-s-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:border-blue-500"> <p id="exchange" class="block text-center p-2.5 w-40 z-20 text-sm text-gray-900 bg-gray-50 border-s-0 border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-s-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:border-blue-500">
$1.00 = $<%= (1 * geoData.toCurrencyRates["USD"]).toFixed(2) %> $1.00 = $<%= (1 * geoData.toCurrencyRates["USD"]).toFixed(2) %>
</p> </p>
</div> </div>
-1
View File
@@ -1,5 +1,4 @@
<!-- Get geolocation if not in session and load conversion rates --> <!-- Get geolocation if not in session and load conversion rates -->
<script src="https://cdn.jsdelivr.net/npm/flowbite@3.1.2/dist/flowbite.min.js"></script>
<script src="/static/scripts/geolocation.js"></script> <script src="/static/scripts/geolocation.js"></script>
<script> <script>
// If no geoData provided thorugh EJS, send update request to backend // If no geoData provided thorugh EJS, send update request to backend
+1 -1
View File
@@ -10,7 +10,7 @@
<% plans.forEach(plan => { %> <% plans.forEach(plan => { %>
<a href="/plans/<%= plan._id %>" class="block max-w-sm p-6 bg-white border border-gray-200 rounded-lg shadow-sm hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700"> <a href="/plans/<%= plan._id %>" class="block max-w-sm p-6 bg-white border border-gray-200 rounded-lg shadow-sm hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700">
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white"><%= plan.name %></h5> <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white"><%= plan.name %></h5>
<div class="w-full bg-gray-200 rounded-full h-2.5 mb-4 dark:bg-gray-700"> <div class="w-full bg-black rounded-full h-2.5 mb-4 dark:bg-black">
<div class="bg-green-600 h-2.5 rounded-full dark:bg-green-500" style="width: <%= plan.progress %>%;"></div> <div class="bg-green-600 h-2.5 rounded-full dark:bg-green-500" style="width: <%= plan.progress %>%;"></div>
</div> </div>
<p class="font-normal text-gray-700 dark:text-gray-400"><%= plan.description %></p> <p class="font-normal text-gray-700 dark:text-gray-400"><%= plan.description %></p>
+1 -1
View File
@@ -56,7 +56,7 @@
<form action="/updateAccount" method="post" class="space-y-4 mt-4" id="account-form"> <form action="/updateAccount" method="post" class="space-y-4 mt-4" id="account-form">
<label for="email" class="block text-sm font-medium text-gray-700">Email</label> <label for="email" class="block text-sm font-medium text-gray-700">Email</label>
<input id="email" disabled type="text" name="email" value="<%= user.email %>" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none"> <input id="email" disabled type="email" name="email" value="<%= user.email %>" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<label for="name" class="block text-sm font-medium text-gray-700">Name</label> <label for="name" class="block text-sm font-medium text-gray-700">Name</label>
<input id="name" disabled type="text" name="name" value="<%= user.name %>" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none"> <input id="name" disabled type="text" name="name" value="<%= user.name %>" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
+36
View File
@@ -0,0 +1,36 @@
<%- include("./partials/fileHeader") %>
<main>
<div class="flex justify-center items-center h-screen">
<form action="/resetLink" method="POST">
<div class="w-96 p-6 shadow-1g bg-white rounded-md">
<h1 class="text-3xl block text-center font-semibold">Reset Password</h1>
<hr class="mt-3">
<input type="hidden" name="token" value="<%=token %>">
<div class="mt-3">
<label for="password" class="block text-base mb-2">New Password:</label>
<input type="password" id="password" name="password"
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
placeholder="Enter Password" />
</div>
<div class="mt-3">
<label for="password" class="block text-base mb-2">Confirm Password:</label>
<input type="password" id="Repassword" name="confirmPassword"
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
placeholder="ReType Password" />
</div>
<% if (typeof errMessage !=='undefined' ) { %>
<div class="text-red-800 font-bold" id="forgor">
<%= errMessage %>
</div>
<% } %>
<div class="mt-5">
<button type="submit"
class="cursor-pointer border-2 border-gray-600 bg-blue-600 text-white py-1 w-full rounded-md hover:bg-transparent hover:text-indigo-700 font-semibold">Change
Password</button>
</div>
</div>
</form>
</div>
</main>
<%- include("./partials/footer") %>
+4 -4
View File
@@ -15,7 +15,7 @@
</div> </div>
<div class="mt-3"> <div class="mt-3">
<label for="email" class="block text-base mb-2">Email</label> <label for="email" class="block text-base mb-2">Email</label>
<input type="text" id="email" name="email" <input type="email" id="email" name="email"
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 " class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
placeholder="Enter Email" /> placeholder="Enter Email" />
</div> </div>
@@ -29,7 +29,9 @@
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 " class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
placeholder="Enter Password" /> placeholder="Enter Password" />
</div> </div>
<div class="text-red-800 font-bold " id="forgor"> <%= errMessage %></div> <div class="text-red-800 font-bold " id="forgor">
<%= errMessage %>
</div>
<div class="mt-5"> <div class="mt-5">
<button type="submit" <button type="submit"
class="border-2 border-gray-600 bg-blue-600 text-white py-1 w-full rounded-md hover:bg-transparent hover:text-indigo-700 font-semibold">Signup</button> class="border-2 border-gray-600 bg-blue-600 text-white py-1 w-full rounded-md hover:bg-transparent hover:text-indigo-700 font-semibold">Signup</button>
@@ -39,8 +41,6 @@
<a href="/login" class="text-indigo-600 font-semibold">Login</a> <a href="/login" class="text-indigo-600 font-semibold">Login</a>
</div> </div>
</div> </div>
</form>
</div>
</main> </main>
<%- include("./partials/footer") %> <%- include("./partials/footer") %>