Compare commits

..
Author SHA1 Message Date
SowinskiBraeden 2c6ea615c6 update/require 8 character password 2025-05-11 18:17:48 -07:00
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 522 additions and 244 deletions

No files matched your search

+3
View File
@@ -1,6 +1,9 @@
# Environment variables
.env
#vscode files
.vscode
# Node modules
node_modules/
+42 -6
View File
@@ -3,6 +3,7 @@ const MongoStore = require("connect-mongo");
const session = require("express-session");
const express = require('express');
const path = require('path');
const bcrypt = require('bcrypt');
const joi = require('joi');
require('dotenv').config();
@@ -11,7 +12,7 @@ const port = process.env.PORT || 3000;
const mongoURI = process.env.MONGO_URI;
const database = process.env.DATABASE; // Database name
const secret = process.env.SECRET || "123-secret-xyz";
const secret = process.env.SECRET || "123-secret-xyz";
/*** Sessions ***/
app.use(session({
@@ -37,11 +38,11 @@ let assets;
let plans;
async function initDatabase() {
const db = await connectMongo(mongoURI, database);
// For any collection, init here
users = await getCollection(db, "users");
users = await getCollection(db, "users");
assets = await getCollection(db, "assets");
plans = await getCollection(db, "plans");
plans = await getCollection(db, "plans");
}
/*** ROUTINGS ***/
@@ -73,6 +74,39 @@ app.get('/aboutUs', (req, res) => {
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
// REALLY DONT DELETE THIS
app.get('/notFound', (req, res) => {
@@ -86,7 +120,9 @@ initDatabase().then(() => {
// Import authentication handler
app.use(require("./src/auth/authentication")(users));
app.use(require('./src/auth/forgotPass')(users));
// Import middleware & apply to user routes
const middleware = require("./src/auth/middleware")(users);
app.use(require('./src/router/user')(middleware, users, plans, assets));
@@ -96,7 +132,7 @@ initDatabase().then(() => {
res.render('notFound');
return res.status(status.NotFound);
});
// Start app
app.listen(port, () => {
console.log(`Server listening on port ${port}`);
+18 -1
View File
@@ -11,12 +11,14 @@
"dependencies": {
"bcrypt": "^5.1.1",
"connect-mongo": "^5.1.0",
"crypto": "^1.0.1",
"dotenv": "^16.5.0",
"ejs": "^3.1.10",
"express": "^5.1.0",
"express-session": "^1.18.1",
"joi": "^17.13.3",
"mongodb": "^6.16.0"
"mongodb": "^6.16.0",
"nodemailer": "^7.0.3"
},
"devDependencies": {
"nodemon": "^3.1.10"
@@ -483,6 +485,12 @@
"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": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
@@ -1430,6 +1438,15 @@
"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": {
"version": "3.1.10",
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.10.tgz",
+3 -1
View File
@@ -20,12 +20,14 @@
"dependencies": {
"bcrypt": "^5.1.1",
"connect-mongo": "^5.1.0",
"crypto": "^1.0.1",
"dotenv": "^16.5.0",
"ejs": "^3.1.10",
"express": "^5.1.0",
"express-session": "^1.18.1",
"joi": "^17.13.3",
"mongodb": "^6.16.0"
"mongodb": "^6.16.0",
"nodemailer": "^7.0.3"
},
"devDependencies": {
"nodemon": "^3.1.10"
+12 -5
View File
@@ -20,7 +20,7 @@ module.exports = (users) => {
const credentialSchema = joi.object({
email: joi.string().email().required(),
password: joi.string().max(20).required(),
password: joi.string().alphanum().max(20).required(),
});
const valid = credentialSchema.validate(req.body);
@@ -56,9 +56,9 @@ module.exports = (users) => {
router.post("/signup", async (req, res) => {
const userSchema = joi.object({
email: joi.string().email().required(),
name: joi.string().alphanum().max(20).required(),
password: joi.string().max(20).min(8).required(),
repassword: joi.string().max(20).min(8).required(),
name: joi.string().pattern(new RegExp('^[a-zA-Z]+$')).max(20).required(),
password: joi.string().alphanum().max(20).min(8).required(),
repassword: joi.string().alphanum().max(20).min(8).required(),
});
const valid = userSchema.validate(req.body);
@@ -69,6 +69,13 @@ module.exports = (users) => {
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) {
req.session.errMessage = "Passwords must match";
res.status(status.BadRequest);
@@ -84,7 +91,7 @@ module.exports = (users) => {
financialData: false,
}).then((results, err) => {
if (err) {
console.error(err);
console.error("Error creating user on signup: ", err);
res.session.errMessage = "Internal server error";
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);
});
// console.log(data);
}
function switchButton(clickedButton) {
+88 -87
View File
@@ -86,7 +86,7 @@ module.exports = (middleware, users, plans, assets) => {
router.get('/assets', async (req, res) => {
let userAssets = await assets.find({ userId: new ObjectId(req.session.user._id) }).toArray();
res.render('assets', {
res.render('assets', {
user: req.session.user,
errMessage: req.session.errMessage,
assets: userAssets,
@@ -98,16 +98,14 @@ module.exports = (middleware, users, plans, assets) => {
router.get('/plans', async (req, res) => {
try {
// console.log(new ObjectId(req.session.user._id));
const userPlansFromDB = await plans.find({userId: new ObjectId(req.session.user._id) }).toArray();
// console.log(userPlansFromDB);
const userPlansFromDB = await plans.find({ userId: new ObjectId(req.session.user._id) }).toArray();
// Use a for...of loop for proper async/await behavior in series for updates
for (const plan of userPlansFromDB) {
const percentage = await calculatePlanProgress(plan, assets, req.session.user._id);
await updatePlanProgressInDB(plan._id, percentage, plans); // Pass the 'plans' collection
}
// Re-fetch plans to get updated progress for rendering
const updatedUserPlans = await plans.find({ userId: new ObjectId(req.session.user._id) }).toArray();
@@ -124,12 +122,12 @@ module.exports = (middleware, users, plans, assets) => {
});
router.get('/plans/:id', async (req, res) => {
try {
const planId = req.params.id;
let userAssets = await assets.find({ userId: new ObjectId(req.session.user._id) }).toArray();
if (!ObjectId.isValid(planId)) {
req.session.errMessage = "Invalid plan ID format.";
return res.status(status.BadRequest).redirect('/plans');
@@ -142,8 +140,7 @@ module.exports = (middleware, users, plans, assets) => {
req.session.errMessage = "Plan not found or you do not have permission to view it.";
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
// or when assets/plans are modified. If an immediate recalculation for this specific view is absolutely needed,
// (e.g., if assets were modified without an immediate plan progress update elsewhere),
@@ -151,13 +148,13 @@ module.exports = (middleware, users, plans, assets) => {
// const currentProgress = await calculatePlanProgress(plan, assets, req.session.user._id);
// plan.progress = currentProgress; // This would only update the 'plan' object for this render, not in DB
res.render('planDetail', {
res.render('planDetail', {
user: req.session.user,
plan: plan, // This plan object will have the progress from the database
geoData: req.session.geoData,
assets: userAssets,
});
} catch (err) {
console.error("Error fetching plan:", err);
req.session.errMessage = "Could not load your plan. Please try again.";
@@ -166,13 +163,13 @@ module.exports = (middleware, users, plans, assets) => {
});
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.";
return res.status(status.Unauthorized).redirect('/questionnaire');
}
const errMessage = req.session.errMessage;
req.session.errMessage = "";
res.render('newPlan', {
req.session.errMessage = "";
res.render('newPlan', {
user: req.session.user,
errMessage: errMessage,
geoData: req.session.geoData
@@ -188,14 +185,14 @@ module.exports = (middleware, users, plans, assets) => {
retirementLiabilities: joi.number().min(0).required(),
});
const validationOptions = { convert: true, abortEarly: false };
const validationOptions = { convert: true, abortEarly: false };
const { error, value } = planSchema.validate(req.body, validationOptions);
if (error) {
if (error) {
console.error("Plan validation error:", error.details);
req.session.errMessage = "Invalid input: " + error.details.map(d => d.message.replace(/"/g, '')).join(', ');
res.status(status.BadRequest).redirect("/newPlan");
return;
req.session.errMessage = "Invalid input: " + error.details.map(d => d.message.replace(/"/g, '')).join(', ');
res.status(status.BadRequest).redirect("/newPlan");
return;
}
const newPlan = {
userId: new ObjectId(req.session.user._id),
@@ -207,12 +204,12 @@ module.exports = (middleware, users, plans, assets) => {
progress: "0"
};
try{
await plans.insertOne({userId: new ObjectId(req.session.user._id), ...newPlan});
req.session.errMessage = "";
res.redirect('/plans');
try {
await plans.insertOne({ userId: new ObjectId(req.session.user._id), ...newPlan });
req.session.errMessage = "";
res.redirect('/plans');
}
catch(err){
catch (err) {
console.error("Error saving plan:", err);
req.session.errMessage = "An error occurred while saving your plan. Please try again.";
res.status(status.InternalServerError).redirect("/newPlan");
@@ -220,7 +217,7 @@ module.exports = (middleware, users, plans, assets) => {
});
router.get('/more', (req, res) => {
res.render('more', {
res.render('more', {
user: req.session.user,
geoData: req.session.geoData
});
@@ -228,7 +225,7 @@ module.exports = (middleware, users, plans, assets) => {
});
router.get('/profile', (req, res) => {
res.render('profile', {
res.render('profile', {
user: req.session.user,
errMessage: req.session.errMessage,
geoData: req.session.geoData
@@ -237,7 +234,7 @@ module.exports = (middleware, users, plans, assets) => {
});
router.get('/settings', (req, res) => {
res.render('settings', {
res.render('settings', {
user: req.session.user,
geoData: req.session.geoData
});
@@ -246,8 +243,8 @@ module.exports = (middleware, users, plans, assets) => {
router.get('/questionnaire', (req, res) => {
const errMessage = req.session.errMessage;
req.session.errMessage = "";
res.render('questionnaire', {
req.session.errMessage = "";
res.render('questionnaire', {
user: req.session.user,
errMessage: errMessage,
geoData: req.session.geoData
@@ -255,8 +252,6 @@ module.exports = (middleware, users, plans, assets) => {
});
router.post('/questionnaire', (req, res) => {
// console.log("Questionnaire POST body:", req.body);
const questionnaireSchema = joi.object({
dob: joi.date().required(),
education: joi.string().valid('primary', 'secondary', 'tertiary', 'postgraduate').required(),
@@ -266,22 +261,22 @@ module.exports = (middleware, users, plans, assets) => {
assets: joi.number().min(0).required(),
liabilities: joi.number().min(0).required(),
});
const validationOptions = { convert: true, abortEarly: false };
const validationOptions = { convert: true, abortEarly: false };
const { error, value } = questionnaireSchema.validate(req.body, validationOptions);
if (error) {
if (error) {
console.error("Questionnaire validation error:", error.details);
req.session.errMessage = "Invalid input: " + error.details.map(d => d.message.replace(/"/g, '')).join(', ');
res.status(status.BadRequest).redirect("/questionnaire");
return;
req.session.errMessage = "Invalid input: " + error.details.map(d => d.message.replace(/"/g, '')).join(', ');
res.status(status.BadRequest).redirect("/questionnaire");
return;
}
users.updateOne(
{ _id: new ObjectId(req.session.user._id) },
{
$set: {
financialData: true,
users.updateOne(
{ _id: new ObjectId(req.session.user._id) },
{
$set: {
financialData: true,
dob: value.dob,
education: value.education,
maritalStatus: value.maritalStatus,
@@ -289,43 +284,49 @@ module.exports = (middleware, users, plans, assets) => {
expenses: value.expenses,
assets: value.assets,
liabilities: value.liabilities,
}
}
}
).then((result) => {
).then((result) => {
if (result.matchedCount === 0) {
console.log(`User not found during questionnaire update: ${req.session.user.email}`);
req.session.errMessage = "User session invalid. Please log in again.";
res.status(status.NotFound).redirect("/login");
req.session.errMessage = "User session invalid. Please log in again.";
res.status(status.NotFound).redirect("/login");
return;
}
if (result.modifiedCount === 0 && result.matchedCount === 1) {
console.log(`User questionnaire data unchanged (already up-to-date): ${req.session.user.email}`);
}
req.session.user.financialData = true;
req.session.errMessage = "";
res.status(status.Ok).redirect("/home");
}).catch(err => {
req.session.errMessage = "";
req.session.save(err => {
if (err) {
res.status(status.InternalServerError).redirect("/plans");
}
res.status(status.Ok).redirect("/plans");
});
}).catch(err => {
console.error("Error updating questionnaire in database:", err);
req.session.errMessage = "An error occurred while saving your information. Please try again.";
res.status(status.InternalServerError).redirect("/questionnaire");
res.status(status.InternalServerError).redirect("/questionnaire");
});
});
router.post("/updateAccount", async (req, res) => {
const accountSchema = joi.object({
email: joi.string().email(),
name: joi.string().alphanum().max(20),
password: joi.string().max(20).min(8),
repassword: joi.string().max(20).min(8),
name: joi.string().pattern(new RegExp('^[a-zA-Z]+$')).max(20),
password: joi.string().alphanum().max(20).min(8),
repassword: joi.string().alphanum().max(20).min(8),
});
const valid = accountSchema.validate(req.body);
if (valid.err) {
req.session.errMessage = "Invalid input",
res.status(status.BadRequest);
res.status(status.BadRequest);
return res.redirect("/profile");
}
@@ -348,20 +349,20 @@ module.exports = (middleware, users, plans, assets) => {
).then((result) => {
if (result.matchedCount === 0) {
console.log(`User not found during account update: ${req.session.email}`);
req.session.errMessage = "User session invalid. Please log in again.";
res.status(status.NotFound).redirect("/login");
req.session.errMessage = "User session invalid. Please log in again.";
res.status(status.NotFound).redirect("/login");
return;
}
if (result.modifiedCount === 0 && result.matchedCount === 1) {
console.log(`User account data unchanged (already up-to-date): ${req.session.email}`);
}
req.session.errMessage = "";
return res.status(status.Ok).redirect("/profile");
}).catch(err => {
req.session.errMessage = "";
return res.status(status.Ok).redirect("/profile");
}).catch(err => {
console.error("Error updating account in database:", err);
req.session.errMessage = "An error occurred while saving your information. Please try again.";
return res.status(status.InternalServerError).redirect("/profile");
return res.status(status.InternalServerError).redirect("/profile");
});
});
@@ -380,7 +381,7 @@ module.exports = (middleware, users, plans, assets) => {
if (valid.err) {
req.session.errMessage = "Invalid input",
res.status(status.BadRequest);
res.status(status.BadRequest);
return res.redirect("/assets");
}
@@ -407,7 +408,7 @@ module.exports = (middleware, users, plans, assets) => {
}
});
req.session.errMessage = "";
req.session.errMessage = "";
return res.status(status.Ok).redirect("/assets");
});
@@ -420,18 +421,18 @@ module.exports = (middleware, users, plans, assets) => {
req.session.errMessage = "Invalid input";
return res.status(status.BadRequest).redirect("/assets");
}
const valid = assetSchema.validate(req.body);
if (valid.err) {
req.session.errMessage = "Invalid input",
res.status(status.BadRequest);
res.status(status.BadRequest);
return res.redirect("/assets");
}
if (req.body.userId != req.session.user._id) {
req.session.errMessage = "Cannot change asset owner",
res.status(status.BadRequest);
res.status(status.BadRequest);
return res.redirect("/assets");
}
@@ -445,11 +446,11 @@ module.exports = (middleware, users, plans, assets) => {
update.value = parseFloat(update.value);
delete update.id;
delete update.userId;
assets.updateOne(
{ "_id": new ObjectId(req.body.id) },
{ $set: update },
).then((result) => {
).then((result) => {
if (result.matchedCount === 0) {
console.log(`Asset not found: ${req.body.id}`);
req.session.errMessage = "Unable to update asset";
@@ -458,14 +459,14 @@ module.exports = (middleware, users, plans, assets) => {
if (result.modifiedCount === 0 && result.matchedCount === 1) {
console.log(`Asset data unchanged (already up-to-date): ${req.body.id}`);
}
req.session.errMessage = "";
return res.status(status.Ok).redirect("/assets");
}).catch((err) => {
req.session.errMessage = "";
return res.status(status.Ok).redirect("/assets");
}).catch((err) => {
console.error("Error updating asset: ", err);
req.session.errMessage = "An error occurred while saving your information. Please try again.";
return res.status(status.InternalServerError).redirect("/assets");
return res.status(status.InternalServerError).redirect("/assets");
});
});
@@ -474,7 +475,7 @@ module.exports = (middleware, users, plans, assets) => {
assets.deleteOne(
{ "_id": id }
).then((result) => {
).then((result) => {
if (result.deletedCount === 0) {
console.error(`Asset not found: ${req.body.id}`);
req.session.errMessage = "Unable to delete asset. Please try again.";
@@ -486,11 +487,11 @@ module.exports = (middleware, users, plans, assets) => {
req.session.errMessage = "An error occurred while deleting an asset. Please try again.";
return res.status(status.InternalServerError).redirect("/assets");
}
req.session.errMessage = "";
return res.status(status.Ok).redirect("/assets");
}).catch((err) => {
req.session.errMessage = "";
return res.status(status.Ok).redirect("/assets");
}).catch((err) => {
console.error("Error deleting asset: ", err);
req.session.errMessage = "An error occurred while deleting an asset. Please try again.";
return res.status(status.InternalServerError).redirect("/assets");
@@ -540,7 +541,7 @@ module.exports = (middleware, users, plans, assets) => {
if (!req.session.geoData.country) {
const response = await fetch(`https://maps.googleapis.com/maps/api/geocode/json?latlng=${req.params.lat},${req.params.lon}&result_type=country&key=${process.env.GEOLOCATION_API}`);
const data = await response.json();
country = data.results[0].formatted_address;
let results = await getRates(country);
req.session.geoData = {
+1 -1
View File
@@ -38,7 +38,7 @@
<!-- 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="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>
<div class="flex items-center">
+112 -91
View File
@@ -1,95 +1,116 @@
<%- include("./partials/fileHeader") %>
<%- include("./partials/header") %>
<%- include("./partials/header") %>
<main>
<!-- Buttons -->
<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="/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>
<!--This is the cards for plans and other things-->
<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">
<!--box to put logo icon if we want on in a box-->
<div class=" relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
<!-- <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> -->
<div class="p-4 flex items-center justify-between">
<p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600">
Retirement goal</p>
<h4
class="block text-right antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900">
$53k</h4>
<main>
<!-- Buttons -->
<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="/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 class="border-t border-blue-gray-50 p-10">
<p 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>
</div>
</div>
<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">
<p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600">
Retirement goal</p>
<h4
class="block text-right antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900">
$53k</h4>
</div>
<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">
<strong class="text-green-500">Make this percent bar or graph or something </strong>&nbsp;than last
week
</p>
</div>
</div>
<div class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
<!-- <div -->
<!-- class="bg-clip-border mx-4 rounded-xl overflow-hidden bg-gradient-to-tr from-green-600 to-green-400 text-white shadow-green-500/40 shadow-lg absolute -mt-4 grid h-16 w-16 place-items-center"> -->
<!-- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" -->
<!-- class="w-6 h-6 text-white"> -->
<!-- <path -->
<!-- d="M6.25 6.375a4.125 4.125 0 118.25 0 4.125 4.125 0 01-8.25 0zM3.25 19.125a7.125 7.125 0 0114.25 0v.003l-.001.119a.75.75 0 01-.363.63 13.067 13.067 0 01-6.761 1.873c-2.472 0-4.786-.684-6.76-1.873a.75.75 0 01-.364-.63l-.001-.122zM19.75 7.5a.75.75 0 00-1.5 0v2.25H16a.75.75 0 000 1.5h2.25v2.25a.75.75 0 001.5 0v-2.25H22a.75.75 0 000-1.5h-2.25V7.5z"> -->
<!-- </path> -->
<!-- </svg> -->
<!-- </div> -->
<!-- we can use this later if needed not sure what it shoudl be for right now. -->
<!-- <div class="p-4 text-right"> -->
<!-- <p class="block antialiased font-sans text-sm leading-normal font-normal text-blue-gray-600">New Clients -->
<!-- </p> -->
<!-- <h4 -->
<!-- class="block antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900"> -->
<!-- 3,462</h4> -->
<!-- </div> -->
<!-- <div class="border-t border-blue-gray-50 p-4"> -->
<!-- <p class="block antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600"> -->
<!-- <strong class="text-red-500">-2%</strong>&nbsp;than yesterday -->
<!-- </p> -->
<!-- </div> -->
<!-- </div> -->
<div 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">
<p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600">
Retirement goal</p>
<h4
class="block text-right antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900">
$53k</h4>
</div>
<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">
<strong class="text-green-500">Make this percent bar or graph or something </strong>&nbsp;than last
week
</p>
</div>
</div>
</div>
</div>
</div>
<div class="text-blue-gray-600">
</div>
</main>
<!--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="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-->
<div class=" relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
<!-- <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> -->
<div class="p-4 flex items-center justify-between">
<p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600">
Retirement goal</p>
<h4
class="block text-right antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900">
$53k</h4>
</div>
<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">
<strong class="text-green-500">Make this percent bar or graph or
something
</strong>&nbsp;than lastweek
</p>
</div>
</div>
<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">
<p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600">
Retirement goal</p>
<h4
class="block text-right antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900">
$53k</h4>
</div>
<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">
<strong class="text-green-500">Make this percent bar or graph or
something
</strong>&nbsp;than last
week
</p>
</div>
</div>
<div class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
<!-- <div -->
<!-- class="bg-clip-border mx-4 rounded-xl overflow-hidden bg-gradient-to-tr from-green-600 to-green-400 text-white shadow-green-500/40 shadow-lg absolute -mt-4 grid h-16 w-16 place-items-center"> -->
<!-- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" -->
<!-- class="w-6 h-6 text-white"> -->
<!-- <path -->
<!-- d="M6.25 6.375a4.125 4.125 0 118.25 0 4.125 4.125 0 01-8.25 0zM3.25 19.125a7.125 7.125 0 0114.25 0v.003l-.001.119a.75.75 0 01-.363.63 13.067 13.067 0 01-6.761 1.873c-2.472 0-4.786-.684-6.76-1.873a.75.75 0 01-.364-.63l-.001-.122zM19.75 7.5a.75.75 0 00-1.5 0v2.25H16a.75.75 0 000 1.5h2.25v2.25a.75.75 0 001.5 0v-2.25H22a.75.75 0 000-1.5h-2.25V7.5z"> -->
<!-- </path> -->
<!-- </svg> -->
<!-- </div> -->
<!-- we can use this later if needed not sure what it shoudl be for right now. -->
<!-- <div class="p-4 text-right"> -->
<!-- <p class="block antialiased font-sans text-sm leading-normal font-normal text-blue-gray-600">New Clients -->
<!-- </p> -->
<!-- <h4 -->
<!-- class="block antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900"> -->
<!-- 3,462</h4> -->
<!-- </div> -->
<!-- <div class="border-t border-blue-gray-50 p-4"> -->
<!-- <p class="block antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600"> -->
<!-- <strong class="text-red-500">-2%</strong>&nbsp;than yesterday -->
<!-- </p> -->
<!-- </div> -->
<!-- </div> -->
<div
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">
<p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600">
Retirement goal</p>
<h4
class="block text-right antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900">
$53k</h4>
</div>
<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">
<strong class="text-green-500">Make this percent bar or
graph or something
</strong>&nbsp;than last
week
</p>
</div>
</div>
</div>
</div>
</div>
<div class="text-blue-gray-600">
</div>
</main>
<%- include("./partials/navBar") %>
<%- include("./partials/scriptLoader") %>
<%- include("./partials/footer") %>
<%- include("./partials/navBar") %>
<%- include("./partials/scriptLoader") %>
<%- include("./partials/footer") %>
+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") %>
+2 -2
View File
@@ -25,7 +25,7 @@
<label>Remember me</label>
</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 class="mt-5">
@@ -41,4 +41,4 @@
</div>
</main>
<%- include("./partials/footer") %>
<%- include("./partials/footer") %>
+2
View File
@@ -7,5 +7,7 @@
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/flowbite@3.1.2/dist/flowbite.min.js"></script>
</body>
</html>
+2 -2
View File
@@ -22,7 +22,7 @@
<p id="flagTag"></p>
</div>
<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>
</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">
@@ -45,7 +45,7 @@
<p id="flagTag"></p>
</div>
<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) %>
</p>
</div>
-1
View File
@@ -1,5 +1,4 @@
<!-- 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>
// If no geoData provided thorugh EJS, send update request to backend
+1 -1
View File
@@ -10,7 +10,7 @@
<% 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">
<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>
<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">
<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>
<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") %>
+43 -43
View File
@@ -1,46 +1,46 @@
<%- include("./partials/fileHeader") %>
<%- include("./partials/headerStart") %>
<%- include("./partials/headerStart") %>
<main>
<div class="flex justify-center items-center h-screen">
<form action="/signup" method="POST">
<div class="w-96 p-6 shadow-1g bg-white rounded-md">
<h1 class="text-3xl block text-center font-semibold">Signup</h1>
<hr class="mt-3">
<div class="mt-3">
<label for="name" class="block text-base mb-2">Name</label>
<input type="text" id="name" name="name"
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
placeholder="Enter Name" />
</div>
<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>
<div class="mt-3">
<label for="password" class="block text-base mb-2">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" />
<label for="password" class="block text-base mb-2 mt-3">Re-type Password</label>
<input type="password" id="repassword" name="repassword"
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="text-red-800 font-bold " id="forgor"> <%= errMessage %></div>
<div class="mt-5">
<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>
</div>
<div class="mt-5 block justify-between items-center">
<label>Already have an account?</label>
<a href="/login" class="text-indigo-600 font-semibold">Login</a>
</div>
</div>
</form>
</div>
</main>
<main>
<div class="flex justify-center items-center h-screen">
<form action="/signup" method="POST">
<div class="w-96 p-6 shadow-1g bg-white rounded-md">
<h1 class="text-3xl block text-center font-semibold">Signup</h1>
<hr class="mt-3">
<div class="mt-3">
<label for="name" class="block text-base mb-2">Name</label>
<input type="text" id="name" name="name"
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
placeholder="Enter Name" />
</div>
<div class="mt-3">
<label for="email" class="block text-base mb-2">Email</label>
<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 "
placeholder="Enter Email" />
</div>
<div class="mt-3">
<label for="password" class="block text-base mb-2">Password</label>
<input type="password" id="password" name="password" minlength="8"
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" />
<label for="password" class="block text-base mb-2 mt-3">Re-type Password</label>
<input type="password" id="repassword" name="repassword" minlength="8"
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="text-red-800 font-bold " id="forgor">
<%= errMessage %>
</div>
<div class="mt-5">
<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>
</div>
<div class="mt-5 block justify-between items-center">
<label>Already have an account?</label>
<a href="/login" class="text-indigo-600 font-semibold">Login</a>
</div>
</div>
</main>
<%- include("./partials/footer") %>
<%- include("./partials/footer") %>