Compare commits
33
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79f0caa3c1 | ||
|
|
4f73959cfb | ||
|
|
6444d7afa7 | ||
|
|
daa984a48f | ||
|
|
383bd15263 | ||
|
|
1e44e8ddfb | ||
|
|
cc875b4e22 | ||
|
|
f3dbbebb43 | ||
|
|
4ee885ac57 | ||
|
|
f3b121fc71 | ||
|
|
07824e6355 | ||
|
|
22850ab2a2 | ||
|
|
69fd776c0f
|
||
|
|
671b67be9d | ||
|
|
99b36d3370 | ||
|
|
1f742d41c3
|
||
|
|
18bee21941
|
||
|
|
1fcd12c6da | ||
|
|
0a9c176274
|
||
|
|
1587f363f7 | ||
|
|
540e191d27
|
||
|
|
1e01e022bf | ||
|
|
c64da1de46 | ||
|
|
7a5d2e7490 | ||
|
|
fc39bcf693 | ||
|
|
29d682c4e8 | ||
|
|
15dd4e0d20 | ||
|
|
cb59e86d8a | ||
|
|
088f9ea55a | ||
|
|
617fc8d877 | ||
|
|
f0b1089e15 | ||
|
|
a40b6d514b | ||
|
|
5819b0d151 |
No files matched your search
@@ -1,6 +1,9 @@
|
|||||||
# Environment variables
|
# Environment variables
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
#vscode files
|
||||||
|
.vscode
|
||||||
|
|
||||||
# Node modules
|
# Node modules
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ const port = process.env.PORT || 3000;
|
|||||||
|
|
||||||
const mongoURI = process.env.MONGO_URI;
|
const mongoURI = process.env.MONGO_URI;
|
||||||
const database = process.env.DATABASE; // Database name
|
const database = process.env.DATABASE; // Database name
|
||||||
const secret = process.env.SECRET || "123-secret-xyz";
|
const secret = process.env.SECRET || "123-secret-xyz";
|
||||||
|
|
||||||
/*** Sessions ***/
|
/*** Sessions ***/
|
||||||
app.use(session({
|
app.use(session({
|
||||||
@@ -39,9 +40,9 @@ async function initDatabase() {
|
|||||||
const db = await connectMongo(mongoURI, database);
|
const db = await connectMongo(mongoURI, database);
|
||||||
|
|
||||||
// For any collection, init here
|
// For any collection, init here
|
||||||
users = await getCollection(db, "users");
|
users = await getCollection(db, "users");
|
||||||
assets = await getCollection(db, "assets");
|
assets = await getCollection(db, "assets");
|
||||||
plans = await getCollection(db, "plans");
|
plans = await getCollection(db, "plans");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** ROUTINGS ***/
|
/*** ROUTINGS ***/
|
||||||
@@ -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);
|
||||||
|
|||||||
Generated
+18
-1
@@ -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
@@ -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"
|
||||||
|
|||||||
@@ -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");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -37,8 +37,6 @@ function update(data) {
|
|||||||
|
|
||||||
dropdown.appendChild(listItem);
|
dropdown.appendChild(listItem);
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function switchButton(clickedButton) {
|
function switchButton(clickedButton) {
|
||||||
|
|||||||
+19
-18
@@ -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');
|
||||||
}
|
}
|
||||||
@@ -207,12 +204,12 @@ module.exports = (middleware, users, plans, assets) => {
|
|||||||
progress: "0"
|
progress: "0"
|
||||||
};
|
};
|
||||||
|
|
||||||
try{
|
try {
|
||||||
await plans.insertOne({userId: new ObjectId(req.session.user._id), ...newPlan});
|
await plans.insertOne({ userId: new ObjectId(req.session.user._id), ...newPlan });
|
||||||
req.session.errMessage = "";
|
req.session.errMessage = "";
|
||||||
res.redirect('/plans');
|
res.redirect('/plans');
|
||||||
}
|
}
|
||||||
catch(err){
|
catch (err) {
|
||||||
console.error("Error saving plan:", err);
|
console.error("Error saving plan:", err);
|
||||||
req.session.errMessage = "An error occurred while saving your plan. Please try again.";
|
req.session.errMessage = "An error occurred while saving your plan. Please try again.";
|
||||||
res.status(status.InternalServerError).redirect("/newPlan");
|
res.status(status.InternalServerError).redirect("/newPlan");
|
||||||
@@ -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,16 +317,16 @@ 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);
|
||||||
|
|
||||||
if (valid.err) {
|
if (valid.err) {
|
||||||
req.session.errMessage = "Invalid input",
|
req.session.errMessage = "Invalid input",
|
||||||
res.status(status.BadRequest);
|
res.status(status.BadRequest);
|
||||||
return res.redirect("/profile");
|
return res.redirect("/profile");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,7 +381,7 @@ module.exports = (middleware, users, plans, assets) => {
|
|||||||
|
|
||||||
if (valid.err) {
|
if (valid.err) {
|
||||||
req.session.errMessage = "Invalid input",
|
req.session.errMessage = "Invalid input",
|
||||||
res.status(status.BadRequest);
|
res.status(status.BadRequest);
|
||||||
return res.redirect("/assets");
|
return res.redirect("/assets");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,13 +426,13 @@ module.exports = (middleware, users, plans, assets) => {
|
|||||||
|
|
||||||
if (valid.err) {
|
if (valid.err) {
|
||||||
req.session.errMessage = "Invalid input",
|
req.session.errMessage = "Invalid input",
|
||||||
res.status(status.BadRequest);
|
res.status(status.BadRequest);
|
||||||
return res.redirect("/assets");
|
return res.redirect("/assets");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.body.userId != req.session.user._id) {
|
if (req.body.userId != req.session.user._id) {
|
||||||
req.session.errMessage = "Cannot change asset owner",
|
req.session.errMessage = "Cannot change asset owner",
|
||||||
res.status(status.BadRequest);
|
res.status(status.BadRequest);
|
||||||
return res.redirect("/assets");
|
return res.redirect("/assets");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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">
|
||||||
|
|||||||
+112
-91
@@ -1,95 +1,116 @@
|
|||||||
<%- include("./partials/fileHeader") %>
|
<%- include("./partials/fileHeader") %>
|
||||||
<%- include("./partials/header") %>
|
<%- include("./partials/header") %>
|
||||||
|
|
||||||
<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"
|
||||||
</div>
|
type="button">Add Asset</a>
|
||||||
<!--This is the cards for plans and other things-->
|
<a href="/newPlan"
|
||||||
<div class="mt-12">
|
class="text-center cursor-pointer min-w-[150px] bg-green-600 px-4 py-2 text-white rounded hover:bg-green-800"
|
||||||
<div class="mb-12 grid gap-y-10 gap-x-6 md:grid-cols-2 mr-3 ml-3 xl:grid-cols-4">
|
type="button">Create new plan </a>
|
||||||
<!--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>
|
||||||
<div class="border-t border-blue-gray-50 p-10">
|
<!--This is the cards for plans and other things-->
|
||||||
<p class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
|
<div class="mt-12">
|
||||||
<strong class="text-green-500">Make this percent bar or graph or something </strong> than lastweek
|
<!--box to put logo icon if we want on in a box-->
|
||||||
</p>
|
<!-- <div -->
|
||||||
</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> -->
|
||||||
<div class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
|
<!--This is the cards for plans and other things-->
|
||||||
<div class="p-4 flex items-center justify-between">
|
<div class="mt-12">
|
||||||
<p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600">
|
<div class="mb-12 grid gap-y-10 gap-x-6 md:grid-cols-2 mr-3 ml-3 xl:grid-cols-4">
|
||||||
Retirement goal</p>
|
<!--box to put logo icon if we want on in a box-->
|
||||||
<h4
|
<div class=" relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
|
||||||
class="block text-right antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900">
|
<!-- <div -->
|
||||||
$53k</h4>
|
<!-- 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> -->
|
||||||
<div class="border-t border-blue-gray-50 p-10">
|
<div class="p-4 flex items-center justify-between">
|
||||||
<p class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
|
<p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600">
|
||||||
<strong class="text-green-500">Make this percent bar or graph or something </strong> than last
|
Retirement goal</p>
|
||||||
week
|
<h4
|
||||||
</p>
|
class="block text-right antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900">
|
||||||
</div>
|
$53k</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
|
<div class="border-t border-blue-gray-50 p-10">
|
||||||
<!-- <div -->
|
<p
|
||||||
<!-- 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"> -->
|
class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
|
||||||
<!-- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" -->
|
<strong class="text-green-500">Make this percent bar or graph or
|
||||||
<!-- class="w-6 h-6 text-white"> -->
|
something
|
||||||
<!-- <path -->
|
</strong> than lastweek
|
||||||
<!-- 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"> -->
|
</p>
|
||||||
<!-- </path> -->
|
</div>
|
||||||
<!-- </svg> -->
|
</div>
|
||||||
<!-- </div> -->
|
<div class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
|
||||||
<!-- we can use this later if needed not sure what it shoudl be for right now. -->
|
<div class="p-4 flex items-center justify-between">
|
||||||
<!-- <div class="p-4 text-right"> -->
|
<p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600">
|
||||||
<!-- <p class="block antialiased font-sans text-sm leading-normal font-normal text-blue-gray-600">New Clients -->
|
Retirement goal</p>
|
||||||
<!-- </p> -->
|
<h4
|
||||||
<!-- <h4 -->
|
class="block text-right antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900">
|
||||||
<!-- class="block antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900"> -->
|
$53k</h4>
|
||||||
<!-- 3,462</h4> -->
|
</div>
|
||||||
<!-- </div> -->
|
<div class="border-t border-blue-gray-50 p-10">
|
||||||
<!-- <div class="border-t border-blue-gray-50 p-4"> -->
|
<p
|
||||||
<!-- <p class="block antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600"> -->
|
class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
|
||||||
<!-- <strong class="text-red-500">-2%</strong> than yesterday -->
|
<strong class="text-green-500">Make this percent bar or graph or
|
||||||
<!-- </p> -->
|
something
|
||||||
<!-- </div> -->
|
</strong> than last
|
||||||
<!-- </div> -->
|
week
|
||||||
<div class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
|
</p>
|
||||||
<div class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
|
</div>
|
||||||
<div class="p-4 flex items-center justify-between">
|
</div>
|
||||||
<p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600">
|
<div class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
|
||||||
Retirement goal</p>
|
<!-- <div -->
|
||||||
<h4
|
<!-- 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"> -->
|
||||||
class="block text-right antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900">
|
<!-- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" -->
|
||||||
$53k</h4>
|
<!-- class="w-6 h-6 text-white"> -->
|
||||||
</div>
|
<!-- <path -->
|
||||||
<div class="border-t border-blue-gray-50 p-10">
|
<!-- 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"> -->
|
||||||
<p class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
|
<!-- </path> -->
|
||||||
<strong class="text-green-500">Make this percent bar or graph or something </strong> than last
|
<!-- </svg> -->
|
||||||
week
|
<!-- </div> -->
|
||||||
</p>
|
<!-- we can use this later if needed not sure what it shoudl be for right now. -->
|
||||||
</div>
|
<!-- <div class="p-4 text-right"> -->
|
||||||
</div>
|
<!-- <p class="block antialiased font-sans text-sm leading-normal font-normal text-blue-gray-600">New Clients -->
|
||||||
</div>
|
<!-- </p> -->
|
||||||
</div>
|
<!-- <h4 -->
|
||||||
</div>
|
<!-- class="block antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900"> -->
|
||||||
<div class="text-blue-gray-600">
|
<!-- 3,462</h4> -->
|
||||||
</div>
|
<!-- </div> -->
|
||||||
</main>
|
<!-- <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> 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> than last
|
||||||
|
week
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-blue-gray-600">
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
<%- include("./partials/navBar") %>
|
<%- include("./partials/navBar") %>
|
||||||
<%- include("./partials/scriptLoader") %>
|
<%- include("./partials/scriptLoader") %>
|
||||||
<%- include("./partials/footer") %>
|
<%- include("./partials/footer") %>
|
||||||
@@ -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
@@ -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">
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -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,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
@@ -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>
|
||||||
|
|||||||
@@ -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">
|
||||||
|
|||||||
@@ -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
@@ -1,46 +1,46 @@
|
|||||||
<%- include("./partials/fileHeader") %>
|
<%- include("./partials/fileHeader") %>
|
||||||
<%- include("./partials/headerStart") %>
|
<%- include("./partials/headerStart") %>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<div class="flex justify-center items-center h-screen">
|
<div class="flex justify-center items-center h-screen">
|
||||||
<form action="/signup" method="POST">
|
<form action="/signup" method="POST">
|
||||||
<div class="w-96 p-6 shadow-1g bg-white rounded-md">
|
<div class="w-96 p-6 shadow-1g bg-white rounded-md">
|
||||||
<h1 class="text-3xl block text-center font-semibold">Signup</h1>
|
<h1 class="text-3xl block text-center font-semibold">Signup</h1>
|
||||||
<hr class="mt-3">
|
<hr class="mt-3">
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<label for="name" class="block text-base mb-2">Name</label>
|
<label for="name" class="block text-base mb-2">Name</label>
|
||||||
<input type="text" id="name" name="name"
|
<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 "
|
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" />
|
placeholder="Enter Name" />
|
||||||
</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>
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<label for="password" class="block text-base mb-2">Password</label>
|
<label for="password" class="block text-base mb-2">Password</label>
|
||||||
<input type="password" id="password" name="password"
|
<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 "
|
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" />
|
||||||
<label for="password" class="block text-base mb-2 mt-3">Re-type Password</label>
|
<label for="password" class="block text-base mb-2 mt-3">Re-type Password</label>
|
||||||
<input type="password" id="repassword" name="repassword"
|
<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 "
|
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">
|
||||||
<div class="mt-5">
|
<%= errMessage %>
|
||||||
<button type="submit"
|
</div>
|
||||||
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 class="mt-5">
|
||||||
</div>
|
<button type="submit"
|
||||||
<div class="mt-5 block justify-between items-center">
|
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>
|
||||||
<label>Already have an account?</label>
|
</div>
|
||||||
<a href="/login" class="text-indigo-600 font-semibold">Login</a>
|
<div class="mt-5 block justify-between items-center">
|
||||||
</div>
|
<label>Already have an account?</label>
|
||||||
</div>
|
<a href="/login" class="text-indigo-600 font-semibold">Login</a>
|
||||||
</form>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<%- include("./partials/footer") %>
|
<%- include("./partials/footer") %>
|
||||||
Reference in new issue
Block a user