Compare commits
24
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ee885ac57 | ||
|
|
f3b121fc71 | ||
|
|
07824e6355 | ||
|
|
22850ab2a2 | ||
|
|
69fd776c0f
|
||
|
|
671b67be9d | ||
|
|
99b36d3370 | ||
|
|
1f742d41c3
|
||
|
|
18bee21941
|
||
|
|
1fcd12c6da | ||
|
|
0a9c176274
|
||
|
|
1587f363f7 | ||
|
|
540e191d27
|
||
|
|
1e01e022bf | ||
|
|
c64da1de46 | ||
|
|
7a5d2e7490 | ||
|
|
fc39bcf693 | ||
|
|
29d682c4e8 | ||
|
|
15dd4e0d20 | ||
|
|
cb59e86d8a | ||
|
|
088f9ea55a | ||
|
|
617fc8d877 | ||
|
|
f0b1089e15 | ||
|
|
a40b6d514b |
No files matched your search
@@ -1,6 +1,9 @@
|
||||
# Environment variables
|
||||
.env
|
||||
|
||||
#vscode files
|
||||
.vscode
|
||||
|
||||
# Node modules
|
||||
node_modules/
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -73,6 +74,86 @@ 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,
|
||||
});
|
||||
});
|
||||
|
||||
app.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');
|
||||
});
|
||||
|
||||
// 404 handler - keep the actual notFound route please
|
||||
// REALLY DONT DELETE THIS
|
||||
app.get('/notFound', (req, res) => {
|
||||
@@ -86,6 +167,8 @@ 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);
|
||||
|
||||
Generated
+18
-1
@@ -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
@@ -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"
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
const express = require('express');
|
||||
const crypto = require('crypto');
|
||||
const joi = require('joi');
|
||||
const nodeMail = require('nodemailer');
|
||||
require('dotenv').config();
|
||||
|
||||
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) => {
|
||||
console.log("we are inside of the post");
|
||||
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:3000/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');
|
||||
}
|
||||
});
|
||||
return router;
|
||||
}
|
||||
|
||||
@@ -37,8 +37,6 @@ function update(data) {
|
||||
|
||||
dropdown.appendChild(listItem);
|
||||
});
|
||||
|
||||
// console.log(data);
|
||||
}
|
||||
|
||||
function switchButton(clickedButton) {
|
||||
|
||||
+8
-13
@@ -98,9 +98,7 @@ 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) {
|
||||
@@ -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.";
|
||||
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,
|
||||
@@ -166,7 +163,7 @@ module.exports = (middleware, users, plans, assets) => {
|
||||
});
|
||||
|
||||
router.get('/newPlan', (req, res) => {
|
||||
if(!req.session.user.financialData){
|
||||
if (!req.session.user.financialData) {
|
||||
req.session.errMessage = "Please complete your financial data before creating a plan.";
|
||||
return res.status(status.Unauthorized).redirect('/questionnaire');
|
||||
}
|
||||
@@ -207,12 +204,12 @@ module.exports = (middleware, users, plans, assets) => {
|
||||
progress: "0"
|
||||
};
|
||||
|
||||
try{
|
||||
await plans.insertOne({userId: new ObjectId(req.session.user._id), ...newPlan});
|
||||
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");
|
||||
@@ -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(),
|
||||
@@ -316,9 +311,9 @@ module.exports = (middleware, users, plans, assets) => {
|
||||
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);
|
||||
|
||||
@@ -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">
|
||||
|
||||
+37
-16
@@ -1,13 +1,23 @@
|
||||
<%- include("./partials/fileHeader") %>
|
||||
<%- include("./partials/header") %>
|
||||
<%- include("./partials/header") %>
|
||||
|
||||
<main>
|
||||
<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>
|
||||
<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">
|
||||
<!--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-->
|
||||
@@ -23,8 +33,11 @@
|
||||
$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 lastweek
|
||||
<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 lastweek
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -37,8 +50,11 @@
|
||||
$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
|
||||
<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>
|
||||
@@ -67,8 +83,10 @@
|
||||
<!-- </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="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>
|
||||
@@ -77,8 +95,11 @@
|
||||
$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
|
||||
<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>
|
||||
@@ -88,8 +109,8 @@
|
||||
</div>
|
||||
<div class="text-blue-gray-600">
|
||||
</div>
|
||||
</main>
|
||||
</main>
|
||||
|
||||
<%- include("./partials/navBar") %>
|
||||
<%- include("./partials/scriptLoader") %>
|
||||
<%- include("./partials/footer") %>
|
||||
<%- include("./partials/navBar") %>
|
||||
<%- include("./partials/scriptLoader") %>
|
||||
<%- 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>
|
||||
</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">
|
||||
|
||||
@@ -7,5 +7,7 @@
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/flowbite@3.1.2/dist/flowbite.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -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,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
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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="text" 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="text" 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") %>
|
||||
@@ -1,7 +1,7 @@
|
||||
<%- include("./partials/fileHeader") %>
|
||||
<%- include("./partials/headerStart") %>
|
||||
<%- include("./partials/headerStart") %>
|
||||
|
||||
<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">
|
||||
@@ -15,7 +15,7 @@
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
<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 "
|
||||
placeholder="Enter Email" />
|
||||
</div>
|
||||
@@ -29,7 +29,9 @@
|
||||
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
|
||||
placeholder="Enter Password" />
|
||||
</div>
|
||||
<div class="text-red-800 font-bold " id="forgor"> <%= errMessage %></div>
|
||||
<div class="text-red-800 font-bold " id="forgor">
|
||||
<%= errMessage %>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<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>
|
||||
@@ -39,8 +41,6 @@
|
||||
<a href="/login" class="text-indigo-600 font-semibold">Login</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
</main>
|
||||
|
||||
<%- include("./partials/footer") %>
|
||||
<%- include("./partials/footer") %>
|
||||
Reference in new issue
Block a user