Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60238b7a9a
|
||
|
|
61db8e162f
|
||
|
|
1c5031f48c
|
||
|
|
b040f12eaf
|
||
|
|
4a02b75a4d | ||
|
|
34c6dd2c66 | ||
|
|
1f3109a68f
|
||
|
|
9ae23ce25e
|
||
|
|
c41f38ce6b | ||
|
|
5771f1372f | ||
|
|
73d61d76de | ||
|
|
50e2d95fda | ||
|
|
370d5d3292 | ||
|
|
c12bbe8336 | ||
|
|
0d59c60a28 | ||
|
|
5e2ac94212 | ||
|
|
f5bc2de24a | ||
|
|
3771288123
|
||
|
|
ccae6a51ff | ||
|
|
206b31e785 | ||
|
|
8166245ab1 | ||
|
|
79f0caa3c1 | ||
|
|
4f73959cfb | ||
|
|
6444d7afa7 | ||
|
|
daa984a48f | ||
|
|
383bd15263 | ||
|
|
1e44e8ddfb | ||
|
|
cc875b4e22 | ||
|
|
f3dbbebb43 | ||
|
|
4ee885ac57 | ||
|
|
f3b121fc71 | ||
|
|
07824e6355 | ||
|
|
22850ab2a2 | ||
|
|
69fd776c0f
|
||
|
|
671b67be9d | ||
|
|
99b36d3370 | ||
|
|
1f742d41c3
|
||
|
|
18bee21941
|
||
|
|
1fcd12c6da | ||
|
|
0a9c176274
|
||
|
|
1587f363f7 | ||
|
|
540e191d27
|
||
|
|
1e01e022bf | ||
|
|
73a510252b
|
||
|
|
42ea4ed8bc
|
||
|
|
1ddb6a9900 | ||
|
|
9c0c560441 | ||
|
|
5763f03288
|
||
|
|
ed06b8731d
|
||
|
|
345cbd2bf2
|
||
|
|
c4a90ceb15
|
||
|
|
ac66323a78
|
||
|
|
c64da1de46 | ||
|
|
7a5d2e7490 | ||
|
|
32437a6e36 | ||
|
|
fc39bcf693 | ||
|
|
29d682c4e8 | ||
|
|
15dd4e0d20 | ||
|
|
cb59e86d8a | ||
|
|
cec777d1bf | ||
|
|
605c7b3734 | ||
|
|
ddf07eee11
|
||
|
|
640ae859e5 | ||
|
|
54024bd7a2
|
||
|
|
821843088d
|
||
|
|
04a7fa428c | ||
|
|
088f9ea55a | ||
|
|
cadbc2187d
|
||
|
|
f417ac00fb | ||
|
|
b2e795427d
|
||
|
|
7ff74b8bbd
|
||
|
|
700ded35e4
|
||
|
|
617fc8d877 | ||
|
|
dbffe122a2
|
||
|
|
d85a4120e2
|
||
|
|
3ad4e20588
|
||
|
|
aedfc17c36
|
||
|
|
4c6945ecbc
|
||
|
|
f0b1089e15 | ||
|
|
a40b6d514b | ||
|
|
78946bb6ca
|
||
|
|
1f8579a052
|
||
|
|
47fc1983f8
|
||
|
|
803330b174
|
||
|
|
5819b0d151 |
No files matched your search
@@ -1,4 +1,8 @@
|
|||||||
mongoURI='mongodb://localhost:27017/'
|
MONGO_URI='mongodb://localhost:27017/'
|
||||||
database='nameOfDatabase'
|
DATABASE='nameOfDatabase'
|
||||||
PORT=8000
|
PORT=8000
|
||||||
secret='123456789'
|
SECRET='123456789'
|
||||||
|
GEOLOCATION_API='api_key'
|
||||||
|
EMAIL_USER=mail@example.com
|
||||||
|
EMAIL_PASS='password'
|
||||||
|
GOOGLE_API_KEY='api_key'
|
||||||
@@ -1,8 +1,14 @@
|
|||||||
# Environment variables
|
# Environment variables
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
#vscode files
|
||||||
|
.vscode
|
||||||
|
|
||||||
# Node modules
|
# Node modules
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
# Sync
|
# Sync
|
||||||
*.sync-conflict*
|
*.sync-conflict*
|
||||||
|
|
||||||
|
# VSCode
|
||||||
|
.vscode/
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"editor.fontFamily": "Monocraft",
|
|
||||||
"editor.fontLigatures": true
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<html>
|
|
||||||
<body>
|
|
||||||
Team Name: BBY-14
|
|
||||||
Team Members:
|
|
||||||
<ul>
|
|
||||||
<li> Joaquin Paredes </li>
|
|
||||||
<li> Nicolas Agostini </li>
|
|
||||||
<li> Mitchell Schaeffer </li>
|
|
||||||
<li> Braeden Sowinski </li>
|
|
||||||
</ul>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -3,15 +3,16 @@ 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();
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const port = process.env.PORT || 3000;
|
const port = process.env.PORT || 3000;
|
||||||
|
|
||||||
const mongoURI = process.env.mongoURI;
|
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({
|
||||||
@@ -33,11 +34,14 @@ app.use(express.json());
|
|||||||
const { connectMongo, getCollection } = require("./src/database/connection");
|
const { connectMongo, getCollection } = require("./src/database/connection");
|
||||||
|
|
||||||
let users;
|
let users;
|
||||||
|
let assets;
|
||||||
|
let plans;
|
||||||
async function initDatabase() {
|
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");
|
||||||
plans = await getCollection(db, "plans");
|
plans = await getCollection(db, "plans");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,20 +74,60 @@ 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
|
||||||
|
// REALLY DONT DELETE THIS
|
||||||
|
app.get('/notFound', (req, res) => {
|
||||||
|
res.render('notFound');
|
||||||
|
return res.status(status.NotFound);
|
||||||
|
});
|
||||||
|
|
||||||
// Initialize database and start app
|
// Initialize database and start app
|
||||||
initDatabase().then(() => {
|
initDatabase().then(() => {
|
||||||
console.log("Successfully connected to MongoDB");
|
console.log("Successfully connected to MongoDB");
|
||||||
|
|
||||||
// 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, plans);
|
const middleware = require("./src/auth/middleware")(users);
|
||||||
app.use(require('./src/router/user')(middleware, users, plans));
|
app.use(require('./src/router/user')(middleware, users, plans, assets));
|
||||||
|
|
||||||
// 404 handler
|
// 404 handler
|
||||||
app.get('/*splat', (req, res) => {
|
app.get('/*splat', (req, res) => {
|
||||||
res.send('404 Not Found');
|
res.render('notFound');
|
||||||
return res.status(status.NotFound);
|
return res.status(status.NotFound);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -9,19 +9,38 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@google/genai": "^0.14.0",
|
||||||
"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",
|
||||||
|
"sweetalert2": "^11.21.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"nodemon": "^3.1.10"
|
"nodemon": "^3.1.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@google/genai": {
|
||||||
|
"version": "0.14.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@google/genai/-/genai-0.14.0.tgz",
|
||||||
|
"integrity": "sha512-nxXbRJZjCUBlPlfTXBMCgkSEpojcLzjxT2Ye3CDiqlXaiSscZ046bDEzztq6ONxUT3BfqHcGsQLhpbR5DU1Mcg==",
|
||||||
|
"dependencies": {
|
||||||
|
"google-auth-library": "^9.14.2",
|
||||||
|
"test-server-sdk": "^0.2.1",
|
||||||
|
"ws": "^8.18.0",
|
||||||
|
"zod": "^3.22.4",
|
||||||
|
"zod-to-json-schema": "^3.22.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@hapi/hoek": {
|
"node_modules/@hapi/hoek": {
|
||||||
"version": "9.3.0",
|
"version": "9.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
|
||||||
@@ -87,6 +106,15 @@
|
|||||||
"integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==",
|
"integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==",
|
||||||
"license": "BSD-3-Clause"
|
"license": "BSD-3-Clause"
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "22.15.17",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.17.tgz",
|
||||||
|
"integrity": "sha512-wIX2aSZL5FE+MR0JlvF87BNVrtFWf6AE6rxSE9X7OwnVvoyCQjpzSRJ+M87se/4QCkCiebQAqrJ0y6fwIyi7nw==",
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"undici-types": "~6.21.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/webidl-conversions": {
|
"node_modules/@types/webidl-conversions": {
|
||||||
"version": "7.0.3",
|
"version": "7.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz",
|
||||||
@@ -102,6 +130,15 @@
|
|||||||
"@types/webidl-conversions": "*"
|
"@types/webidl-conversions": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/yauzl": {
|
||||||
|
"version": "2.10.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz",
|
||||||
|
"integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==",
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/abbrev": {
|
"node_modules/abbrev": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
||||||
@@ -209,12 +246,46 @@
|
|||||||
"integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==",
|
"integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/asynckit": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||||
|
},
|
||||||
|
"node_modules/axios": {
|
||||||
|
"version": "1.9.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.9.0.tgz",
|
||||||
|
"integrity": "sha512-re4CqKTJaURpzbLHtIi6XpDv20/CnpXOtjRY5/CU32L8gU8ek9UIivcfvSWvmKEngmVbrUtPpdDwWDWL7DNHvg==",
|
||||||
|
"dependencies": {
|
||||||
|
"follow-redirects": "^1.15.6",
|
||||||
|
"form-data": "^4.0.0",
|
||||||
|
"proxy-from-env": "^1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/balanced-match": {
|
"node_modules/balanced-match": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
|
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/base64-js": {
|
||||||
|
"version": "1.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||||
|
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "consulting",
|
||||||
|
"url": "https://feross.org/support"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"node_modules/bcrypt": {
|
"node_modules/bcrypt": {
|
||||||
"version": "5.1.1",
|
"version": "5.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-5.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-5.1.1.tgz",
|
||||||
@@ -229,6 +300,14 @@
|
|||||||
"node": ">= 10.0.0"
|
"node": ">= 10.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/bignumber.js": {
|
||||||
|
"version": "9.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.3.0.tgz",
|
||||||
|
"integrity": "sha512-EM7aMFTXbptt/wZdMlBv2t8IViwQL+h6SLHosp8Yf0dqJMTnY6iL32opnAB6kAdL0SZPuvcAzFr31o0c/R3/RA==",
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/binary-extensions": {
|
"node_modules/binary-extensions": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
|
||||||
@@ -300,6 +379,19 @@
|
|||||||
"node": ">=16.20.1"
|
"node": ">=16.20.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/buffer-crc32": {
|
||||||
|
"version": "0.2.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
|
||||||
|
"integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/buffer-equal-constant-time": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="
|
||||||
|
},
|
||||||
"node_modules/bytes": {
|
"node_modules/bytes": {
|
||||||
"version": "3.1.2",
|
"version": "3.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
||||||
@@ -415,6 +507,17 @@
|
|||||||
"color-support": "bin.js"
|
"color-support": "bin.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/combined-stream": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||||
|
"dependencies": {
|
||||||
|
"delayed-stream": "~1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/concat-map": {
|
"node_modules/concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
@@ -483,6 +586,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",
|
||||||
@@ -500,6 +609,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/delayed-stream": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/delegates": {
|
"node_modules/delegates": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
|
||||||
@@ -550,6 +667,14 @@
|
|||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/ecdsa-sig-formatter": {
|
||||||
|
"version": "1.0.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
|
||||||
|
"integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"safe-buffer": "^5.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/ee-first": {
|
"node_modules/ee-first": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||||
@@ -586,6 +711,14 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/end-of-stream": {
|
||||||
|
"version": "1.4.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||||
|
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||||
|
"dependencies": {
|
||||||
|
"once": "^1.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/es-define-property": {
|
"node_modules/es-define-property": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||||
@@ -616,6 +749,20 @@
|
|||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/es-set-tostringtag": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
|
||||||
|
"dependencies": {
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"get-intrinsic": "^1.2.6",
|
||||||
|
"has-tostringtag": "^1.0.2",
|
||||||
|
"hasown": "^2.0.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/escape-html": {
|
"node_modules/escape-html": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||||
@@ -713,6 +860,38 @@
|
|||||||
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/extend": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
|
||||||
|
},
|
||||||
|
"node_modules/extract-zip": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==",
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.1.1",
|
||||||
|
"get-stream": "^5.1.0",
|
||||||
|
"yauzl": "^2.10.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"extract-zip": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.17.0"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@types/yauzl": "^2.9.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fd-slicer": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==",
|
||||||
|
"dependencies": {
|
||||||
|
"pend": "~1.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/filelist": {
|
"node_modules/filelist": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz",
|
||||||
@@ -773,6 +952,58 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/follow-redirects": {
|
||||||
|
"version": "1.15.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
|
||||||
|
"integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"debug": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/form-data": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==",
|
||||||
|
"dependencies": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.8",
|
||||||
|
"es-set-tostringtag": "^2.1.0",
|
||||||
|
"mime-types": "^2.1.12"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/form-data/node_modules/mime-db": {
|
||||||
|
"version": "1.52.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||||
|
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/form-data/node_modules/mime-types": {
|
||||||
|
"version": "2.1.35",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||||
|
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||||
|
"dependencies": {
|
||||||
|
"mime-db": "1.52.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/forwarded": {
|
"node_modules/forwarded": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||||
@@ -866,6 +1097,71 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/gaxios": {
|
||||||
|
"version": "6.7.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-6.7.1.tgz",
|
||||||
|
"integrity": "sha512-LDODD4TMYx7XXdpwxAVRAIAuB0bzv0s+ywFonY46k126qzQHT9ygyoa9tncmOiQmmDrik65UYsEkv3lbfqQ3yQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"extend": "^3.0.2",
|
||||||
|
"https-proxy-agent": "^7.0.1",
|
||||||
|
"is-stream": "^2.0.0",
|
||||||
|
"node-fetch": "^2.6.9",
|
||||||
|
"uuid": "^9.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/gaxios/node_modules/agent-base": {
|
||||||
|
"version": "7.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz",
|
||||||
|
"integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 14"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/gaxios/node_modules/https-proxy-agent": {
|
||||||
|
"version": "7.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
|
||||||
|
"integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
|
||||||
|
"dependencies": {
|
||||||
|
"agent-base": "^7.1.2",
|
||||||
|
"debug": "4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 14"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/gcp-metadata": {
|
||||||
|
"version": "5.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-5.3.0.tgz",
|
||||||
|
"integrity": "sha512-FNTkdNEnBdlqF2oatizolQqNANMrcqJt6AAYt99B3y1aLLC8Hc5IOBb+ZnnzllodEEf6xMBp6wRcBbc16fa65w==",
|
||||||
|
"optional": true,
|
||||||
|
"peer": true,
|
||||||
|
"dependencies": {
|
||||||
|
"gaxios": "^5.0.0",
|
||||||
|
"json-bigint": "^1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/gcp-metadata/node_modules/gaxios": {
|
||||||
|
"version": "5.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-5.1.3.tgz",
|
||||||
|
"integrity": "sha512-95hVgBRgEIRQQQHIbnxBXeHbW4TqFk4ZDJW7wmVtvYar72FdhRIo1UGOLS2eRAKCPEdPBWu+M7+A33D9CdX9rA==",
|
||||||
|
"optional": true,
|
||||||
|
"peer": true,
|
||||||
|
"dependencies": {
|
||||||
|
"extend": "^3.0.2",
|
||||||
|
"https-proxy-agent": "^5.0.0",
|
||||||
|
"is-stream": "^2.0.0",
|
||||||
|
"node-fetch": "^2.6.9"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/get-intrinsic": {
|
"node_modules/get-intrinsic": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||||
@@ -903,6 +1199,20 @@
|
|||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/get-stream": {
|
||||||
|
"version": "5.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
|
||||||
|
"integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
|
||||||
|
"dependencies": {
|
||||||
|
"pump": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/glob": {
|
"node_modules/glob": {
|
||||||
"version": "7.2.3",
|
"version": "7.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
||||||
@@ -937,6 +1247,43 @@
|
|||||||
"node": ">= 6"
|
"node": ">= 6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/google-auth-library": {
|
||||||
|
"version": "9.15.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-9.15.1.tgz",
|
||||||
|
"integrity": "sha512-Jb6Z0+nvECVz+2lzSMt9u98UsoakXxA2HGHMCxh+so3n90XgYWkq5dur19JAJV7ONiJY22yBTyJB1TSkvPq9Ng==",
|
||||||
|
"dependencies": {
|
||||||
|
"base64-js": "^1.3.0",
|
||||||
|
"ecdsa-sig-formatter": "^1.0.11",
|
||||||
|
"gaxios": "^6.1.1",
|
||||||
|
"gcp-metadata": "^6.1.0",
|
||||||
|
"gtoken": "^7.0.0",
|
||||||
|
"jws": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/google-auth-library/node_modules/gcp-metadata": {
|
||||||
|
"version": "6.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-6.1.1.tgz",
|
||||||
|
"integrity": "sha512-a4tiq7E0/5fTjxPAaH4jpjkSv/uCaU2p5KC6HVGrvl0cDjA8iBZv4vv1gyzlmK0ZUKqwpOyQMKzZQe3lTit77A==",
|
||||||
|
"dependencies": {
|
||||||
|
"gaxios": "^6.1.1",
|
||||||
|
"google-logging-utils": "^0.0.2",
|
||||||
|
"json-bigint": "^1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/google-logging-utils": {
|
||||||
|
"version": "0.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-0.0.2.tgz",
|
||||||
|
"integrity": "sha512-NEgUnEcBiP5HrPzufUkBzJOD/Sxsco3rLNo1F1TNf7ieU8ryUzBhqba8r756CjLX7rn3fHl6iLEwPYuqpoKgQQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/gopd": {
|
"node_modules/gopd": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
||||||
@@ -949,6 +1296,18 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/gtoken": {
|
||||||
|
"version": "7.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/gtoken/-/gtoken-7.1.0.tgz",
|
||||||
|
"integrity": "sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw==",
|
||||||
|
"dependencies": {
|
||||||
|
"gaxios": "^6.0.0",
|
||||||
|
"jws": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/has-flag": {
|
"node_modules/has-flag": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||||
@@ -970,6 +1329,20 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/has-tostringtag": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
|
||||||
|
"dependencies": {
|
||||||
|
"has-symbols": "^1.0.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/has-unicode": {
|
"node_modules/has-unicode": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
|
||||||
@@ -1123,6 +1496,17 @@
|
|||||||
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
|
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/is-stream": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/jake": {
|
"node_modules/jake": {
|
||||||
"version": "10.9.2",
|
"version": "10.9.2",
|
||||||
"resolved": "https://registry.npmjs.org/jake/-/jake-10.9.2.tgz",
|
"resolved": "https://registry.npmjs.org/jake/-/jake-10.9.2.tgz",
|
||||||
@@ -1154,6 +1538,33 @@
|
|||||||
"@sideway/pinpoint": "^2.0.0"
|
"@sideway/pinpoint": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/json-bigint": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"bignumber.js": "^9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/jwa": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==",
|
||||||
|
"dependencies": {
|
||||||
|
"buffer-equal-constant-time": "^1.0.1",
|
||||||
|
"ecdsa-sig-formatter": "1.0.11",
|
||||||
|
"safe-buffer": "^5.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/jws": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==",
|
||||||
|
"dependencies": {
|
||||||
|
"jwa": "^2.0.0",
|
||||||
|
"safe-buffer": "^5.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/kruptein": {
|
"node_modules/kruptein": {
|
||||||
"version": "3.0.7",
|
"version": "3.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/kruptein/-/kruptein-3.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/kruptein/-/kruptein-3.0.7.tgz",
|
||||||
@@ -1430,6 +1841,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",
|
||||||
@@ -1598,6 +2018,11 @@
|
|||||||
"node": ">=16"
|
"node": ">=16"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/pend": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg=="
|
||||||
|
},
|
||||||
"node_modules/picomatch": {
|
"node_modules/picomatch": {
|
||||||
"version": "2.3.1",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
|
||||||
@@ -1624,6 +2049,11 @@
|
|||||||
"node": ">= 0.10"
|
"node": ">= 0.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/proxy-from-env": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
|
||||||
|
},
|
||||||
"node_modules/pstree.remy": {
|
"node_modules/pstree.remy": {
|
||||||
"version": "1.1.8",
|
"version": "1.1.8",
|
||||||
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
|
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
|
||||||
@@ -1631,6 +2061,15 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/pump": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==",
|
||||||
|
"dependencies": {
|
||||||
|
"end-of-stream": "^1.1.0",
|
||||||
|
"once": "^1.3.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/punycode": {
|
"node_modules/punycode": {
|
||||||
"version": "2.3.1",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||||
@@ -1990,6 +2429,15 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/sweetalert2": {
|
||||||
|
"version": "11.21.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.21.0.tgz",
|
||||||
|
"integrity": "sha512-fiEK7SqRY/QD/wC2uqEHlfYGZ7qe2UcyQbJpbpj4YRVqplBgcI+euPZLZL+evLINcvbtXmL1SFUdZHKqBHGAAQ==",
|
||||||
|
"funding": {
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://github.com/sponsors/limonte"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/tar": {
|
"node_modules/tar": {
|
||||||
"version": "6.2.1",
|
"version": "6.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz",
|
||||||
@@ -2007,6 +2455,17 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/test-server-sdk": {
|
||||||
|
"version": "0.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/test-server-sdk/-/test-server-sdk-0.2.1.tgz",
|
||||||
|
"integrity": "sha512-o9F0HEBZbdDMwZ5xwSafkVb0C2nlZ4hq/g/aMgyLniTs69J7zoQJzF5eA3ZN6MPRoYPhy/QsQ/BuRtqaXzawvw==",
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^1.6.0",
|
||||||
|
"extract-zip": "^2.0.1",
|
||||||
|
"tar": "^6.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/to-regex-range": {
|
"node_modules/to-regex-range": {
|
||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
||||||
@@ -2084,6 +2543,12 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/undici-types": {
|
||||||
|
"version": "6.21.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
|
||||||
|
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"node_modules/unpipe": {
|
"node_modules/unpipe": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||||
@@ -2099,6 +2564,18 @@
|
|||||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
|
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/uuid": {
|
||||||
|
"version": "9.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
|
||||||
|
"integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
|
||||||
|
"funding": [
|
||||||
|
"https://github.com/sponsors/broofa",
|
||||||
|
"https://github.com/sponsors/ctavan"
|
||||||
|
],
|
||||||
|
"bin": {
|
||||||
|
"uuid": "dist/bin/uuid"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/vary": {
|
"node_modules/vary": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||||
@@ -2145,11 +2622,56 @@
|
|||||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
"node_modules/ws": {
|
||||||
|
"version": "8.18.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.2.tgz",
|
||||||
|
"integrity": "sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"bufferutil": "^4.0.1",
|
||||||
|
"utf-8-validate": ">=5.0.2"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"bufferutil": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"utf-8-validate": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/yallist": {
|
"node_modules/yallist": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
|
},
|
||||||
|
"node_modules/yauzl": {
|
||||||
|
"version": "2.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
|
||||||
|
"integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==",
|
||||||
|
"dependencies": {
|
||||||
|
"buffer-crc32": "~0.2.3",
|
||||||
|
"fd-slicer": "~1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/zod": {
|
||||||
|
"version": "3.24.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/zod/-/zod-3.24.4.tgz",
|
||||||
|
"integrity": "sha512-OdqJE9UDRPwWsrHjLN2F8bPxvwJBK22EHLWtanu0LSYr5YqzsaaW3RMgmjwr8Rypg5k+meEJdSPXJZXE/yqOMg==",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/colinhacks"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/zod-to-json-schema": {
|
||||||
|
"version": "3.24.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz",
|
||||||
|
"integrity": "sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==",
|
||||||
|
"peerDependencies": {
|
||||||
|
"zod": "^3.24.1"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,14 +18,18 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/JoaquinPar/2800-202510-BBY14#readme",
|
"homepage": "https://github.com/JoaquinPar/2800-202510-BBY14#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@google/genai": "^0.14.0",
|
||||||
"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",
|
||||||
|
"sweetalert2": "^11.21.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"nodemon": "^3.1.10"
|
"nodemon": "^3.1.10"
|
||||||
|
|||||||
@@ -1,21 +1,34 @@
|
|||||||
const status = require("../util/statuses");
|
const status = require("../util/statuses");
|
||||||
|
const session = require("express-session");
|
||||||
const bcrypt = require('bcrypt');
|
const bcrypt = require('bcrypt');
|
||||||
const joi = require("joi");
|
const joi = require("joi");
|
||||||
const salt = 12;
|
const salt = 12;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {MongoClient.collection} users db collection
|
||||||
|
* @returns {express.Router} authentication router
|
||||||
|
*/
|
||||||
module.exports = (users) => {
|
module.exports = (users) => {
|
||||||
const router = require("express").Router();
|
const router = require("express").Router();
|
||||||
|
|
||||||
router.get("/logout", (req, res) => {
|
router.get("/logout", (req, res) => {
|
||||||
req.session.destroy();
|
req.session.destroy((err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error("Failed to destroy session: ", err);
|
||||||
|
res.status(status.InternalServerError);
|
||||||
|
return res.redirect("back");
|
||||||
|
}
|
||||||
|
|
||||||
|
res.status(status.Ok);
|
||||||
return res.redirect('/login');
|
return res.redirect('/login');
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
router.post("/login", async (req, res) => {
|
router.post("/login", async (req, res) => {
|
||||||
|
|
||||||
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);
|
||||||
@@ -41,19 +54,28 @@ module.exports = (users) => {
|
|||||||
|
|
||||||
req.session.authenticated = true;
|
req.session.authenticated = true;
|
||||||
req.session.userId = user._id;
|
req.session.userId = user._id;
|
||||||
req.session.email = req.body.email;
|
|
||||||
req.session.errMessage = "";
|
req.session.errMessage = "";
|
||||||
res.redirect("/home");
|
|
||||||
return res.status(status.Ok);
|
req.session.save((err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error("Failed to save session: ", err);
|
||||||
|
req.session.errMessage = "Failed to save session. Please try again.";
|
||||||
|
res.status(status.InternalServerError);
|
||||||
|
return res.redirect("/login");
|
||||||
|
}
|
||||||
|
|
||||||
|
res.status(status.Ok);
|
||||||
|
return res.redirect("/home");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
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);
|
||||||
@@ -64,6 +86,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);
|
||||||
@@ -79,17 +108,26 @@ 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");
|
||||||
}
|
}
|
||||||
|
|
||||||
req.session.authenticated = true;
|
req.session.authenticated = true;
|
||||||
req.session.email = req.body.email;
|
|
||||||
req.session.userId = results.insertedId;
|
req.session.userId = results.insertedId;
|
||||||
|
|
||||||
req.session.errMessage = "";
|
req.session.errMessage = "";
|
||||||
return res.status(status.Ok).redirect("/home");
|
|
||||||
|
req.session.save((err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error("Failed to save session: ", err);
|
||||||
|
req.session.errMessage = "Please login";
|
||||||
|
res.status(status.Ok);
|
||||||
|
return res.redirect("/login");
|
||||||
|
}
|
||||||
|
|
||||||
|
res.status(status.Ok);
|
||||||
|
return res.redirect("/home");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,119 @@
|
|||||||
|
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,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
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"); // nice
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,30 +1,70 @@
|
|||||||
const status = require("../util/statuses");
|
const status = require("../util/statuses");
|
||||||
const session = require("express-session");
|
const session = require("express-session");
|
||||||
|
const ObjectId = require("mongodb").ObjectId;
|
||||||
|
|
||||||
|
// Get all names of user routes
|
||||||
|
let userRouter = require("../router/user")((req, res, next) => next(), null, null, null);
|
||||||
|
userRouter.stack.shift();
|
||||||
|
const userRoutes = userRouter.stack.map((layer) => layer.route.path.split("/")[1]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* createMiddleware returns a middleware function for express.
|
* @param {MongoClient.collection} users db collection
|
||||||
* @param {MongoClient.collection} users
|
* @returns {async function} middleware handler function
|
||||||
* @return {async function}
|
|
||||||
*/
|
*/
|
||||||
const createMiddleware = (users) => {
|
const createMiddleware = (users) => {
|
||||||
return async (req, res, next) => {
|
return async (req, res, next) => {
|
||||||
if (!req.session.authenticated || !req.session.email) {
|
// Check if incoming request route exists in user routes
|
||||||
|
// redirect to 404 if not
|
||||||
|
if (!userRoutes.includes(req.url.split("/")[1].split("?")[0])) {
|
||||||
|
return res.status(status.NotFound).redirect("/notFound");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!req.session.authenticated || !req.session.userId) {
|
||||||
req.session.errMessage = "Please login to view that resource";
|
req.session.errMessage = "Please login to view that resource";
|
||||||
res.redirect("/login");
|
res.redirect("/login");
|
||||||
return res.status(status.Unauthorized);
|
return res.status(status.Unauthorized);
|
||||||
}
|
}
|
||||||
|
|
||||||
let user = await users.findOne({ "email": req.session.email }).then((user) => user);
|
if (!req.session.user) {
|
||||||
|
let user = await users.findOne({ _id: new ObjectId(req.session.userId) }).then((user) => user);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
|
return req.session.destroy((err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error("Failed to destroy session: ", err);
|
||||||
|
req.session.errMessage = "Failed to logout. Please try again";
|
||||||
|
res.status(status.InternalServerError);
|
||||||
|
return res.redirect("/home");
|
||||||
|
}
|
||||||
|
|
||||||
req.session.errMessage = "User not found";
|
req.session.errMessage = "User not found";
|
||||||
|
res.status(status.NotFound);
|
||||||
res.redirect("/login");
|
res.redirect("/login");
|
||||||
return res.status(status.Unauthorized);
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
req.session.user = user;
|
||||||
|
return req.session.save((err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error("Failed to save session: ", err);
|
||||||
|
|
||||||
|
return req.session.destroy((err) => {
|
||||||
|
req.session.errMessage = "Failed to save session, please login again.";
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
console.error("Failed to destroy session: ", err);
|
||||||
|
}
|
||||||
|
|
||||||
|
res.status(status.InternalServerError);
|
||||||
|
res.redirect("/login");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
next();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
req.user = user;
|
|
||||||
next();
|
next();
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
module.exports = createMiddleware;
|
module.exports = createMiddleware;
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
const assetForms = [
|
||||||
|
"create-other-asset-form",
|
||||||
|
"create-saving-asset-form",
|
||||||
|
"create-stock-asset-form"
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* resetAll asset creation forms
|
||||||
|
*/
|
||||||
|
function resetAll() {
|
||||||
|
document.getElementById("dropdown-icon-button").innerHTML = `
|
||||||
|
<img src="/static/svgs/icons/Other.svg" class="h-4 w-4 me-2" alt="Other"> Other
|
||||||
|
<svg class="w-2.5 h-2.5 ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
|
||||||
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
|
||||||
|
</svg>
|
||||||
|
`;
|
||||||
|
document.getElementById("create-other-asset-form").reset();
|
||||||
|
document.getElementById("create-saving-asset-form").reset();
|
||||||
|
document.getElementById("create-stock-asset-form").reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* selectAssetForm changes which form is displayed
|
||||||
|
* to create specified assets.
|
||||||
|
* @param {string} assetFormId
|
||||||
|
*/
|
||||||
|
function selectAssetForm(assetFormId) {
|
||||||
|
for (let i = 0; i < assetForms.length; i++) {
|
||||||
|
if (assetForms[i] == assetFormId) {
|
||||||
|
document.getElementById(assetFormId).style.display = "block";
|
||||||
|
} else {
|
||||||
|
document.getElementById(assetForms[i]).style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* resetRadio to default to other asset type.
|
||||||
|
*/
|
||||||
|
function resetRadio() {
|
||||||
|
document.getElementById("asset-other").checked = true;
|
||||||
|
document.getElementById("asset-saving").checked = false;
|
||||||
|
document.getElementById("asset-stock").checked = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const assetKeys = {
|
||||||
|
other: [
|
||||||
|
"name",
|
||||||
|
"dropdown-icon-button",
|
||||||
|
"value",
|
||||||
|
"description",
|
||||||
|
"purchaseDate",
|
||||||
|
],
|
||||||
|
saving: [
|
||||||
|
"name",
|
||||||
|
"value",
|
||||||
|
],
|
||||||
|
stock: [
|
||||||
|
"ticker",
|
||||||
|
"price",
|
||||||
|
"quantity",
|
||||||
|
"purchaseDate",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* lockAsset prevents edits to asset view modal
|
||||||
|
* @param {string} assetId
|
||||||
|
* @param {string} icon to defualt to
|
||||||
|
*/
|
||||||
|
function lockAsset(assetId, icon) {
|
||||||
|
let dropdown = document.getElementById(`dropdown-icon-button-${assetId}`);
|
||||||
|
if (dropdown) dropdown.innerHTML = `
|
||||||
|
<img src="/static/svgs/icons/${icon}.svg" class="h-4 w-4 me-2" alt="${icon}"> ${icon}
|
||||||
|
<svg class="w-2.5 h-2.5 ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
|
||||||
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
|
||||||
|
</svg>
|
||||||
|
`;
|
||||||
|
|
||||||
|
document.getElementById(`${assetId}-form`).reset();
|
||||||
|
|
||||||
|
const type = document.getElementById(`type-${assetId}`).value;
|
||||||
|
|
||||||
|
assetKeys[type].forEach((key) => {
|
||||||
|
document.getElementById(`${key}-${assetId}`).disabled = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById(`save-${assetId}`).disabled = true;
|
||||||
|
document.getElementById(`save-${assetId}`).classList.remove("cursor-pointer");
|
||||||
|
document.getElementById(`save-${assetId}`).classList.add("cursor-not-allowed");
|
||||||
|
|
||||||
|
document.getElementById(`edit-${assetId}`).innerHTML = "Edit";
|
||||||
|
document.getElementById(`edit-${assetId}`).onclick = () => { unlockAsset(assetId, icon) };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* unlockAsset allows edits to asset view modal
|
||||||
|
* @param {string} assetId
|
||||||
|
* @param {string} icon to defualt to
|
||||||
|
*/
|
||||||
|
function unlockAsset(assetId, icon) {
|
||||||
|
const type = document.getElementById(`type-${assetId}`).value;
|
||||||
|
|
||||||
|
assetKeys[type].forEach((key) => {
|
||||||
|
document.getElementById(`${key}-${assetId}`).disabled = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById(`save-${assetId}`).disabled = false;
|
||||||
|
document.getElementById(`save-${assetId}`).classList.remove("cursor-not-allowed");
|
||||||
|
document.getElementById(`save-${assetId}`).classList.add("cursor-pointer");
|
||||||
|
|
||||||
|
document.getElementById(`edit-${assetId}`).innerHTML = "Cancel";
|
||||||
|
document.getElementById(`edit-${assetId}`).onclick = () => { lockAsset(assetId, icon) };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* autoOpenCreate checks if popup param
|
||||||
|
* in url to auto open create popup
|
||||||
|
*/
|
||||||
|
function autoOpenCreate() {
|
||||||
|
const query = window.location.search;
|
||||||
|
const params = new URLSearchParams(query);
|
||||||
|
|
||||||
|
if (params.has("popup")) {
|
||||||
|
document.getElementById('create-asset-modal').showModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* selectIcon updated selected icon while creating
|
||||||
|
* or modifying assets.
|
||||||
|
* @param {button element} selectedIcon
|
||||||
|
* @param {string} assetId
|
||||||
|
*/
|
||||||
|
function selectIcon(selectedIcon, assetId="") {
|
||||||
|
document.getElementById(`dropdown-icon-button${assetId != "" ? "-" : ""}${assetId}`).value = selectedIcon.value;
|
||||||
|
document.getElementById(`icon${assetId != "" ? "-" : ""}${assetId}`).value = selectedIcon.value
|
||||||
|
|
||||||
|
document.getElementById(`dropdown-icon-button${assetId != "" ? "-" : ""}${assetId}`).innerHTML = selectedIcon.innerHTML +
|
||||||
|
`
|
||||||
|
<svg class="w-2.5 h-2.5 ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
|
||||||
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
|
||||||
|
</svg>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
resetRadio();
|
||||||
|
autoOpenCreate();
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
const factButton = document.getElementById("factButton");
|
||||||
|
const factMenu = document.getElementById("factMenu");
|
||||||
|
const factInput = document.getElementById("factInput");
|
||||||
|
const factSubmitButton = document.getElementById("factSubmitButton");
|
||||||
|
|
||||||
|
factButton.addEventListener("click", () => {
|
||||||
|
factMenu.classList.toggle("hidden");
|
||||||
|
});
|
||||||
|
factSubmitButton.addEventListener("click", () => {
|
||||||
|
fetch("/fact", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
fact: factInput.value,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
Swal.fire('Here is a fact!', data.fact, 'success');
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error("Error fetching fact:", error);
|
||||||
|
Swal.fire('Error fetching fact', 'Please try again later', 'error');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -5,6 +5,7 @@ function getLocation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function update(data) {
|
function update(data) {
|
||||||
|
if (data.data.message != "error") {
|
||||||
document.getElementById("loading").style = "display: none";
|
document.getElementById("loading").style = "display: none";
|
||||||
document.getElementById("currencyExchange").style = "display: flex";
|
document.getElementById("currencyExchange").style = "display: flex";
|
||||||
|
|
||||||
@@ -37,8 +38,14 @@ function update(data) {
|
|||||||
|
|
||||||
dropdown.appendChild(listItem);
|
dropdown.appendChild(listItem);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
console.log(data);
|
document.getElementById("loading").style = "display: none";
|
||||||
|
document.getElementById("exFrom").style = "display: none";
|
||||||
|
document.getElementById("dropdown-country-button").style = "display: none";
|
||||||
|
document.getElementById("currencyExchange").style = "display: flex";
|
||||||
|
document.getElementById("exchange").innerHTML = "Country not supported";
|
||||||
|
document.getElementById("exchange").className = "block rounded-lg text-center p-2.5 w-50 z-20 text-sm border bg-gray-700 border-gray-600 placeholder-gray-400 text-white focus:border-blue-500";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function switchButton(clickedButton) {
|
function switchButton(clickedButton) {
|
||||||
@@ -54,7 +61,7 @@ function switchButton(clickedButton) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateExchange(exRate) {
|
function updateExchange(exRate) {
|
||||||
document.getElementById("exchange1").innerHTML = "$1.00 = $" +`${(1 * exRate).toFixed(2)}`;
|
document.getElementById("exchange").innerHTML = "$1.00 = $" +`${(1 * exRate).toFixed(2)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getLatestExchange(position) {
|
async function getLatestExchange(position) {
|
||||||
@@ -67,5 +74,11 @@ async function getLatestExchange(position) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function error(err) {
|
function error(err) {
|
||||||
console.error("Geolocation error: ", err);
|
const data = {
|
||||||
|
data: {
|
||||||
|
message: "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
update(data);
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,7 @@ function lockAccount() {
|
|||||||
document.getElementById("password").disabled = true;
|
document.getElementById("password").disabled = true;
|
||||||
document.getElementById("repassword").disabled = true;
|
document.getElementById("repassword").disabled = true;
|
||||||
document.getElementById("save-account").classList.add("cursor-not-allowed");
|
document.getElementById("save-account").classList.add("cursor-not-allowed");
|
||||||
|
document.getElementById("save-account").classList.remove("cursor-pointer");
|
||||||
|
|
||||||
document.getElementById("edit-account").innerHTML = "Edit";
|
document.getElementById("edit-account").innerHTML = "Edit";
|
||||||
document.getElementById("edit-account").onclick = unlockAccount;
|
document.getElementById("edit-account").onclick = unlockAccount;
|
||||||
@@ -30,7 +31,12 @@ function lockPersonal() {
|
|||||||
document.getElementById("ms-married").disabled = true;
|
document.getElementById("ms-married").disabled = true;
|
||||||
document.getElementById("ms-divorced").disabled = true;
|
document.getElementById("ms-divorced").disabled = true;
|
||||||
document.getElementById("ms-widowed").disabled = true;
|
document.getElementById("ms-widowed").disabled = true;
|
||||||
|
document.getElementById("income").disabled = true;
|
||||||
|
document.getElementById("expenses").disabled = true;
|
||||||
|
document.getElementById("assets").disabled = true;
|
||||||
|
document.getElementById("liabilities").disabled = true;
|
||||||
document.getElementById("save-personal").classList.add("cursor-not-allowed");
|
document.getElementById("save-personal").classList.add("cursor-not-allowed");
|
||||||
|
document.getElementById("save-personal").classList.remove("cursor-pointer");
|
||||||
|
|
||||||
document.getElementById("edit-personal").innerHTML = "Edit";
|
document.getElementById("edit-personal").innerHTML = "Edit";
|
||||||
document.getElementById("edit-personal").onclick = unlockPersonal;
|
document.getElementById("edit-personal").onclick = unlockPersonal;
|
||||||
@@ -42,11 +48,12 @@ function lockPersonal() {
|
|||||||
*/
|
*/
|
||||||
function unlockAccount() {
|
function unlockAccount() {
|
||||||
document.getElementById("save-account").disabled = false;
|
document.getElementById("save-account").disabled = false;
|
||||||
// document.getElementById("email").disabled = false;
|
document.getElementById("email").disabled = false;
|
||||||
document.getElementById("name").disabled = false;
|
document.getElementById("name").disabled = false;
|
||||||
document.getElementById("password").disabled = false;
|
document.getElementById("password").disabled = false;
|
||||||
document.getElementById("repassword").disabled = false;
|
document.getElementById("repassword").disabled = false;
|
||||||
document.getElementById("save-account").classList.remove("cursor-not-allowed");
|
document.getElementById("save-account").classList.remove("cursor-not-allowed");
|
||||||
|
document.getElementById("save-account").classList.add("cursor-pointer");
|
||||||
|
|
||||||
document.getElementById("edit-account").innerHTML = "Cancel changes";
|
document.getElementById("edit-account").innerHTML = "Cancel changes";
|
||||||
document.getElementById("edit-account").onclick = lockAccount;
|
document.getElementById("edit-account").onclick = lockAccount;
|
||||||
@@ -64,7 +71,12 @@ function unlockPersonal() {
|
|||||||
document.getElementById("ms-married").disabled = false;
|
document.getElementById("ms-married").disabled = false;
|
||||||
document.getElementById("ms-divorced").disabled = false;
|
document.getElementById("ms-divorced").disabled = false;
|
||||||
document.getElementById("ms-widowed").disabled = false;
|
document.getElementById("ms-widowed").disabled = false;
|
||||||
|
document.getElementById("income").disabled = false;
|
||||||
|
document.getElementById("expenses").disabled = false;
|
||||||
|
document.getElementById("assets").disabled = false;
|
||||||
|
document.getElementById("liabilities").disabled = false;
|
||||||
document.getElementById("save-personal").classList.remove("cursor-not-allowed");
|
document.getElementById("save-personal").classList.remove("cursor-not-allowed");
|
||||||
|
document.getElementById("save-personal").classList.add("cursor-pointer");
|
||||||
|
|
||||||
document.getElementById("edit-personal").innerHTML = "Cancel changes";
|
document.getElementById("edit-personal").innerHTML = "Cancel changes";
|
||||||
document.getElementById("edit-personal").onclick = lockPersonal;
|
document.getElementById("edit-personal").onclick = lockPersonal;
|
||||||
@@ -72,4 +84,4 @@ function unlockPersonal() {
|
|||||||
|
|
||||||
// On page load, ensure forms are locked and reset
|
// On page load, ensure forms are locked and reset
|
||||||
lockAccount();
|
lockAccount();
|
||||||
// lockPersonal();
|
lockPersonal();
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="flag-icons-eu" viewBox="0 0 640 480">
|
||||||
|
<defs>
|
||||||
|
<g id="eu-d">
|
||||||
|
<g id="eu-b">
|
||||||
|
<path id="eu-a" d="m0-1-.3 1 .5.1z"/>
|
||||||
|
<use xlink:href="#eu-a" transform="scale(-1 1)"/>
|
||||||
|
</g>
|
||||||
|
<g id="eu-c">
|
||||||
|
<use xlink:href="#eu-b" transform="rotate(72)"/>
|
||||||
|
<use xlink:href="#eu-b" transform="rotate(144)"/>
|
||||||
|
</g>
|
||||||
|
<use xlink:href="#eu-c" transform="scale(-1 1)"/>
|
||||||
|
</g>
|
||||||
|
</defs>
|
||||||
|
<path fill="#039" d="M0 0h640v480H0z"/>
|
||||||
|
<g fill="#fc0" transform="translate(320 242.3)scale(23.7037)">
|
||||||
|
<use xlink:href="#eu-d" width="100%" height="100%" y="-6"/>
|
||||||
|
<use xlink:href="#eu-d" width="100%" height="100%" y="6"/>
|
||||||
|
<g id="eu-e">
|
||||||
|
<use xlink:href="#eu-d" width="100%" height="100%" x="-6"/>
|
||||||
|
<use xlink:href="#eu-d" width="100%" height="100%" transform="rotate(-144 -2.3 -2.1)"/>
|
||||||
|
<use xlink:href="#eu-d" width="100%" height="100%" transform="rotate(144 -2.1 -2.3)"/>
|
||||||
|
<use xlink:href="#eu-d" width="100%" height="100%" transform="rotate(72 -4.7 -2)"/>
|
||||||
|
<use xlink:href="#eu-d" width="100%" height="100%" transform="rotate(72 -5 .5)"/>
|
||||||
|
</g>
|
||||||
|
<use xlink:href="#eu-e" width="100%" height="100%" transform="scale(-1 1)"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M312 32c-13.3 0-24 10.7-24 24s10.7 24 24 24l25.7 0 34.6 64-149.4 0-27.4-38C191 99.7 183.7 96 176 96l-56 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l43.7 0 22.1 30.7-26.6 53.1c-10-2.5-20.5-3.8-31.2-3.8C57.3 224 0 281.3 0 352s57.3 128 128 128c65.3 0 119.1-48.9 127-112l49 0c8.5 0 16.3-4.5 20.7-11.8l84.8-143.5 21.7 40.1C402.4 276.3 384 312 384 352c0 70.7 57.3 128 128 128s128-57.3 128-128s-57.3-128-128-128c-13.5 0-26.5 2.1-38.7 6L375.4 48.8C369.8 38.4 359 32 347.2 32L312 32zM458.6 303.7l32.3 59.7c6.3 11.7 20.9 16 32.5 9.7s16-20.9 9.7-32.5l-32.3-59.7c3.6-.6 7.4-.9 11.2-.9c39.8 0 72 32.2 72 72s-32.2 72-72 72s-72-32.2-72-72c0-18.6 7-35.5 18.6-48.3zM133.2 368l65 0c-7.3 32.1-36 56-70.2 56c-39.8 0-72-32.2-72-72s32.2-72 72-72c1.7 0 3.4 .1 5.1 .2l-24.2 48.5c-9 18.1 4.1 39.4 24.3 39.4zm33.7-48l50.7-101.3 72.9 101.2-.1 .1-123.5 0zm90.6-128l108.5 0L317 274.8 257.4 192z"/></svg>
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M96 0C43 0 0 43 0 96L0 416c0 53 43 96 96 96l288 0 32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l0-64c17.7 0 32-14.3 32-32l0-320c0-17.7-14.3-32-32-32L384 0 96 0zm0 384l256 0 0 64L96 448c-17.7 0-32-14.3-32-32s14.3-32 32-32zm32-240c0-8.8 7.2-16 16-16l192 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-192 0c-8.8 0-16-7.2-16-16zm16 48l192 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-192 0c-8.8 0-16-7.2-16-16s7.2-16 16-16z"/></svg>
|
||||||
|
After Width: | Height: | Size: 626 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M149.1 64.8L138.7 96 64 96C28.7 96 0 124.7 0 160L0 416c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-256c0-35.3-28.7-64-64-64l-74.7 0L362.9 64.8C356.4 45.2 338.1 32 317.4 32L194.6 32c-20.7 0-39 13.2-45.5 32.8zM256 192a96 96 0 1 1 0 192 96 96 0 1 1 0-192z"/></svg>
|
||||||
|
After Width: | Height: | Size: 489 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M135.2 117.4L109.1 192l293.8 0-26.1-74.6C372.3 104.6 360.2 96 346.6 96L165.4 96c-13.6 0-25.7 8.6-30.2 21.4zM39.6 196.8L74.8 96.3C88.3 57.8 124.6 32 165.4 32l181.2 0c40.8 0 77.1 25.8 90.6 64.3l35.2 100.5c23.2 9.6 39.6 32.5 39.6 59.2l0 144 0 48c0 17.7-14.3 32-32 32l-32 0c-17.7 0-32-14.3-32-32l0-48L96 400l0 48c0 17.7-14.3 32-32 32l-32 0c-17.7 0-32-14.3-32-32l0-48L0 256c0-26.7 16.4-49.6 39.6-59.2zM128 288a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm288 32a32 32 0 1 0 0-64 32 32 0 1 0 0 64z"/></svg>
|
||||||
|
After Width: | Height: | Size: 713 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M512 80c0 18-14.3 34.6-38.4 48c-29.1 16.1-72.5 27.5-122.3 30.9c-3.7-1.8-7.4-3.5-11.3-5C300.6 137.4 248.2 128 192 128c-8.3 0-16.4 .2-24.5 .6l-1.1-.6C142.3 114.6 128 98 128 80c0-44.2 86-80 192-80S512 35.8 512 80zM160.7 161.1c10.2-.7 20.7-1.1 31.3-1.1c62.2 0 117.4 12.3 152.5 31.4C369.3 204.9 384 221.7 384 240c0 4-.7 7.9-2.1 11.7c-4.6 13.2-17 25.3-35 35.5c0 0 0 0 0 0c-.1 .1-.3 .1-.4 .2c0 0 0 0 0 0s0 0 0 0c-.3 .2-.6 .3-.9 .5c-35 19.4-90.8 32-153.6 32c-59.6 0-112.9-11.3-148.2-29.1c-1.9-.9-3.7-1.9-5.5-2.9C14.3 274.6 0 258 0 240c0-34.8 53.4-64.5 128-75.4c10.5-1.5 21.4-2.7 32.7-3.5zM416 240c0-21.9-10.6-39.9-24.1-53.4c28.3-4.4 54.2-11.4 76.2-20.5c16.3-6.8 31.5-15.2 43.9-25.5l0 35.4c0 19.3-16.5 37.1-43.8 50.9c-14.6 7.4-32.4 13.7-52.4 18.5c.1-1.8 .2-3.5 .2-5.3zm-32 96c0 18-14.3 34.6-38.4 48c-1.8 1-3.6 1.9-5.5 2.9C304.9 404.7 251.6 416 192 416c-62.8 0-118.6-12.6-153.6-32C14.3 370.6 0 354 0 336l0-35.4c12.5 10.3 27.6 18.7 43.9 25.5C83.4 342.6 135.8 352 192 352s108.6-9.4 148.1-25.9c7.8-3.2 15.3-6.9 22.4-10.9c6.1-3.4 11.8-7.2 17.2-11.2c1.5-1.1 2.9-2.3 4.3-3.4l0 3.4 0 5.7 0 26.3zm32 0l0-32 0-25.9c19-4.2 36.5-9.5 52.1-16c16.3-6.8 31.5-15.2 43.9-25.5l0 35.4c0 10.5-5 21-14.9 30.9c-16.3 16.3-45 29.7-81.3 38.4c.1-1.7 .2-3.5 .2-5.3zM192 448c56.2 0 108.6-9.4 148.1-25.9c16.3-6.8 31.5-15.2 43.9-25.5l0 35.4c0 44.2-86 80-192 80S0 476.2 0 432l0-35.4c12.5 10.3 27.6 18.7 43.9 25.5C83.4 438.6 135.8 448 192 448z"/></svg>
|
||||||
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M192 64C86 64 0 150 0 256S86 448 192 448l256 0c106 0 192-86 192-192s-86-192-192-192L192 64zM496 168a40 40 0 1 1 0 80 40 40 0 1 1 0-80zM392 304a40 40 0 1 1 80 0 40 40 0 1 1 -80 0zM168 200c0-13.3 10.7-24 24-24s24 10.7 24 24l0 32 32 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-32 0 0 32c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-32-32 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l32 0 0-32z"/></svg>
|
||||||
|
After Width: | Height: | Size: 602 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M64 0C28.7 0 0 28.7 0 64L0 352c0 35.3 28.7 64 64 64l176 0-10.7 32L160 448c-17.7 0-32 14.3-32 32s14.3 32 32 32l256 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-69.3 0L336 416l176 0c35.3 0 64-28.7 64-64l0-288c0-35.3-28.7-64-64-64L64 0zM512 64l0 224L64 288 64 64l448 0z"/></svg>
|
||||||
|
After Width: | Height: | Size: 491 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M176 24c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40c-35.3 0-64 28.7-64 64l-40 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l40 0 0 56-40 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l40 0 0 56-40 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l40 0c0 35.3 28.7 64 64 64l0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40 56 0 0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40 56 0 0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40c35.3 0 64-28.7 64-64l40 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-40 0 0-56 40 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-40 0 0-56 40 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-40 0c0-35.3-28.7-64-64-64l0-40c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40-56 0 0-40c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40-56 0 0-40zM160 128l192 0c17.7 0 32 14.3 32 32l0 192c0 17.7-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32l0-192c0-17.7 14.3-32 32-32zm192 32l-192 0 0 192 192 0 0-192z"/></svg>
|
||||||
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M349.4 44.6c5.9-13.7 1.5-29.7-10.6-38.5s-28.6-8-39.9 1.8l-256 224c-10 8.8-13.6 22.9-8.9 35.3S50.7 288 64 288l111.5 0L98.6 467.4c-5.9 13.7-1.5 29.7 10.6 38.5s28.6 8 39.9-1.8l256-224c10-8.8 13.6-22.9 8.9-35.3s-16.6-20.7-30-20.7l-111.5 0L349.4 44.6z"/></svg>
|
||||||
|
After Width: | Height: | Size: 477 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M575.8 255.5c0 18-15 32.1-32 32.1l-32 0 .7 160.2c0 2.7-.2 5.4-.5 8.1l0 16.2c0 22.1-17.9 40-40 40l-16 0c-1.1 0-2.2 0-3.3-.1c-1.4 .1-2.8 .1-4.2 .1L416 512l-24 0c-22.1 0-40-17.9-40-40l0-24 0-64c0-17.7-14.3-32-32-32l-64 0c-17.7 0-32 14.3-32 32l0 64 0 24c0 22.1-17.9 40-40 40l-24 0-31.9 0c-1.5 0-3-.1-4.5-.2c-1.2 .1-2.4 .2-3.6 .2l-16 0c-22.1 0-40-17.9-40-40l0-112c0-.9 0-1.9 .1-2.8l0-69.7-32 0c-18 0-32-14-32-32.1c0-9 3-17 10-24L266.4 8c7-7 15-8 22-8s15 2 21 7L564.8 231.5c8 7 12 15 11 24z"/></svg>
|
||||||
|
After Width: | Height: | Size: 715 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M128 32C92.7 32 64 60.7 64 96l0 256 64 0 0-256 384 0 0 256 64 0 0-256c0-35.3-28.7-64-64-64L128 32zM19.2 384C8.6 384 0 392.6 0 403.2C0 445.6 34.4 480 76.8 480l486.4 0c42.4 0 76.8-34.4 76.8-76.8c0-10.6-8.6-19.2-19.2-19.2L19.2 384z"/></svg>
|
||||||
|
After Width: | Height: | Size: 459 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M0 112.5L0 422.3c0 18 10.1 35 27 41.3c87 32.5 174 10.3 261-11.9c79.8-20.3 159.6-40.7 239.3-18.9c23 6.3 48.7-9.5 48.7-33.4l0-309.9c0-18-10.1-35-27-41.3C462 15.9 375 38.1 288 60.3C208.2 80.6 128.4 100.9 48.7 79.1C25.6 72.8 0 88.6 0 112.5zM128 416l-64 0 0-64c35.3 0 64 28.7 64 64zM64 224l0-64 64 0c0 35.3-28.7 64-64 64zM448 352c0-35.3 28.7-64 64-64l0 64-64 0zm64-192c-35.3 0-64-28.7-64-64l64 0 0 64zM384 256c0 61.9-43 112-96 112s-96-50.1-96-112s43-112 96-112s96 50.1 96 112zM252 208c0 9.7 6.9 17.7 16 19.6l0 48.4-4 0c-11 0-20 9-20 20s9 20 20 20l24 0 24 0c11 0 20-9 20-20s-9-20-20-20l-4 0 0-68c0-11-9-20-20-20l-16 0c-11 0-20 9-20 20z"/></svg>
|
||||||
|
After Width: | Height: | Size: 860 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M280 32c-13.3 0-24 10.7-24 24s10.7 24 24 24l57.7 0 16.4 30.3L256 192l-45.3-45.3c-12-12-28.3-18.7-45.3-18.7L64 128c-17.7 0-32 14.3-32 32l0 32 96 0c88.4 0 160 71.6 160 160c0 11-1.1 21.7-3.2 32l70.4 0c-2.1-10.3-3.2-21-3.2-32c0-52.2 25-98.6 63.7-127.8l15.4 28.6C402.4 276.3 384 312 384 352c0 70.7 57.3 128 128 128s128-57.3 128-128s-57.3-128-128-128c-13.5 0-26.5 2.1-38.7 6L418.2 128l61.8 0c17.7 0 32-14.3 32-32l0-32c0-17.7-14.3-32-32-32l-20.4 0c-7.5 0-14.7 2.6-20.5 7.4L391.7 78.9l-14-26c-7-12.9-20.5-21-35.2-21L280 32zM462.7 311.2l28.2 52.2c6.3 11.7 20.9 16 32.5 9.7s16-20.9 9.7-32.5l-28.2-52.2c2.3-.3 4.7-.4 7.1-.4c35.3 0 64 28.7 64 64s-28.7 64-64 64s-64-28.7-64-64c0-15.5 5.5-29.7 14.7-40.8zM187.3 376c-9.5 23.5-32.5 40-59.3 40c-35.3 0-64-28.7-64-64s28.7-64 64-64c26.9 0 49.9 16.5 59.3 40l66.4 0C242.5 268.8 190.5 224 128 224C57.3 224 0 281.3 0 352s57.3 128 128 128c62.5 0 114.5-44.8 125.8-104l-66.4 0zM128 384a32 32 0 1 0 0-64 32 32 0 1 0 0 64z"/></svg>
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M184 48l144 0c4.4 0 8 3.6 8 8l0 40L176 96l0-40c0-4.4 3.6-8 8-8zm-56 8l0 40L64 96C28.7 96 0 124.7 0 160l0 96 192 0 128 0 192 0 0-96c0-35.3-28.7-64-64-64l-64 0 0-40c0-30.9-25.1-56-56-56L184 0c-30.9 0-56 25.1-56 56zM512 288l-192 0 0 32c0 17.7-14.3 32-32 32l-64 0c-17.7 0-32-14.3-32-32l0-32L0 288 0 416c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-128z"/></svg>
|
||||||
|
After Width: | Height: | Size: 584 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M16 64C16 28.7 44.7 0 80 0L304 0c35.3 0 64 28.7 64 64l0 384c0 35.3-28.7 64-64 64L80 512c-35.3 0-64-28.7-64-64L16 64zM224 448a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zM304 64L80 64l0 320 224 0 0-320z"/></svg>
|
||||||
|
After Width: | Height: | Size: 423 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M470.7 9.4c3 3.1 5.3 6.6 6.9 10.3s2.4 7.8 2.4 12.2c0 0 0 .1 0 .1c0 0 0 0 0 0l0 96c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-18.7L310.6 214.6c-11.8 11.8-30.8 12.6-43.5 1.7L176 138.1 84.8 216.3c-13.4 11.5-33.6 9.9-45.1-3.5s-9.9-33.6 3.5-45.1l112-96c12-10.3 29.7-10.3 41.7 0l89.5 76.7L370.7 64 352 64c-17.7 0-32-14.3-32-32s14.3-32 32-32l96 0s0 0 0 0c8.8 0 16.8 3.6 22.6 9.3l.1 .1zM0 304c0-26.5 21.5-48 48-48l416 0c26.5 0 48 21.5 48 48l0 160c0 26.5-21.5 48-48 48L48 512c-26.5 0-48-21.5-48-48L0 304zM48 416l0 48 48 0c0-26.5-21.5-48-48-48zM96 304l-48 0 0 48c26.5 0 48-21.5 48-48zM464 416c-26.5 0-48 21.5-48 48l48 0 0-48zM416 304c0 26.5 21.5 48 48 48l0-48-48 0zm-96 80a64 64 0 1 0 -128 0 64 64 0 1 0 128 0z"/></svg>
|
||||||
|
After Width: | Height: | Size: 926 B |
@@ -1,41 +1,77 @@
|
|||||||
const status = require("../util/statuses");
|
|
||||||
const getRates = require("../util/exchangeRate");
|
const getRates = require("../util/exchangeRate");
|
||||||
const bcrypt = require('bcrypt');
|
const { calculatePlanProgress, updatePlanProgressInDB } = require("../util/calculations");
|
||||||
|
const suggestions = require("../util/suggestions");
|
||||||
|
const status = require("../util/statuses");
|
||||||
|
const ObjectId = require('mongodb').ObjectId;
|
||||||
|
const session = require("express-session");
|
||||||
|
const bcrypt = require("bcrypt");
|
||||||
|
const path = require("path");
|
||||||
const joi = require("joi");
|
const joi = require("joi");
|
||||||
const { ObjectId } = require('mongodb');
|
const fs = require("fs");
|
||||||
const salt = 12;
|
const salt = 12;
|
||||||
|
|
||||||
module.exports = (middleware, users, plans) => {
|
/**
|
||||||
|
* getAssetSchema returns correct joi object
|
||||||
|
* to validate req.body depending on asset type
|
||||||
|
* @param {string} type of asset
|
||||||
|
* @returns {joi.object} schema
|
||||||
|
*/
|
||||||
|
const getAssetSchema = (type) => {
|
||||||
|
let assetSchema;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case "other":
|
||||||
|
assetSchema = joi.object({
|
||||||
|
type: joi.string().valid("other", "stock", "saving").required(),
|
||||||
|
icon: joi.string().alphanum().required(),
|
||||||
|
name: joi.string().alphanum().min(3).max(30).required(),
|
||||||
|
value: joi.number().min(0).required(),
|
||||||
|
purchaseDate: joi.date().required(),
|
||||||
|
description: joi.string().alphanum().max(240),
|
||||||
|
id: joi.string().alphanum(), // May be passed when updating existing asset
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "saving":
|
||||||
|
assetSchema = joi.object({
|
||||||
|
type: joi.string().valid("other", "stock", "saving").required(),
|
||||||
|
name: joi.string().alphanum().min(3).max(30).required(),
|
||||||
|
value: joi.number().min(0).required(),
|
||||||
|
id: joi.string().alphanum(), // May be passed when updating existing asset
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "stock":
|
||||||
|
assetSchema = joi.object({
|
||||||
|
type: joi.string().valid("other", "stock", "saving").required(),
|
||||||
|
ticker: joi.string().alphanum().min(3).max(5).required(),
|
||||||
|
price: joi.number().min(0).required(),
|
||||||
|
quantity: joi.number().min(1).required(),
|
||||||
|
purchaseDate: joi.date().required(),
|
||||||
|
id: joi.string().alphanum(), // May be passed when updating existing asset
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
return assetSchema;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {function} middleware handler
|
||||||
|
* @param {MongoClient.collection} users db collection
|
||||||
|
* @param {MongoClient.collection} assets db collection
|
||||||
|
* @returns {express.Router} user protected routes router
|
||||||
|
*/
|
||||||
|
module.exports = (middleware, users, plans, assets) => {
|
||||||
const router = require("express").Router();
|
const router = require("express").Router();
|
||||||
|
|
||||||
|
// Create list of icon filenames
|
||||||
|
let icons = fs.readdirSync(path.join(__dirname, "../public/svgs/icons"));
|
||||||
|
icons = icons.map((icon) => icon.split(".")[0]);
|
||||||
|
|
||||||
router.use(middleware);
|
router.use(middleware);
|
||||||
|
|
||||||
router.get('/home', async (req, res) => {
|
router.get('/home', async (req, res) => {
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
<% if (countryRates.length == 0) { %>
|
|
||||||
render loading icon
|
|
||||||
<% } else { %>
|
|
||||||
render exchange
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
stuff
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
if (countryRates.length == 0) {
|
|
||||||
get geo
|
|
||||||
|
|
||||||
receive exchange
|
|
||||||
|
|
||||||
replace loading with exchange
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
*/
|
|
||||||
|
|
||||||
// if no session with geoData
|
// if no session with geoData
|
||||||
if (!req.session.geoData) {
|
if (!req.session.geoData) {
|
||||||
req.session.geoData = {
|
req.session.geoData = {
|
||||||
@@ -49,26 +85,35 @@ module.exports = (middleware, users, plans) => {
|
|||||||
return res.status(status.Ok);
|
return res.status(status.Ok);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/assets', (req, res) => {
|
router.get('/assets', async (req, res) => {
|
||||||
res.render('assets', { user: req.user });
|
let userAssets = await assets.find({ userId: new ObjectId(req.session.userId) }).toArray();
|
||||||
|
res.render('assets', {
|
||||||
|
user: req.session.user,
|
||||||
|
errMessage: req.session.errMessage,
|
||||||
|
assets: userAssets,
|
||||||
|
geoData: req.session.geoData,
|
||||||
|
icons: icons,
|
||||||
|
});
|
||||||
return res.status(status.Ok);
|
return res.status(status.Ok);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/plans', async (req, res) => {
|
router.get('/plans', async (req, res) => {
|
||||||
if (!req.session.email) {
|
try {
|
||||||
return res.status(status.Unauthorized).redirect('/login');
|
const userPlansFromDB = await plans.find({ userId: new ObjectId(req.session.userId) }).toArray();
|
||||||
|
|
||||||
|
for (const plan of userPlansFromDB) {
|
||||||
|
const percentage = await calculatePlanProgress(plan, assets, req.session.user._id);
|
||||||
|
await updatePlanProgressInDB(plan._id, percentage, plans);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
const updatedUserPlans = await plans.find({ userId: new ObjectId(req.session.user._id) }).toArray();
|
||||||
|
|
||||||
|
|
||||||
// console.log(req.user.email);
|
|
||||||
const userPlans = await plans.find({userEmail: req.user.email }).toArray();
|
|
||||||
// console.log(userPlans);
|
|
||||||
res.render('plans', {
|
res.render('plans', {
|
||||||
user: req.user,
|
user: req.session.user,
|
||||||
plans: userPlans
|
plans: updatedUserPlans,
|
||||||
|
geoData: req.session.geoData
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Error fetching plans:", err);
|
console.error("Error fetching plans:", err);
|
||||||
req.session.errMessage = "Could not load your plans. Please try again.";
|
req.session.errMessage = "Could not load your plans. Please try again.";
|
||||||
@@ -77,30 +122,30 @@ module.exports = (middleware, users, plans) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.get('/plans/:id', async (req, res) => {
|
router.get('/plans/:id', async (req, res) => {
|
||||||
if (!req.session.email) {
|
|
||||||
return res.status(status.Unauthorized).redirect('/login');
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const planId = req.params.id;
|
const planId = req.params.id;
|
||||||
|
let userAssets = await assets.find({ userId: new ObjectId(req.session.userId) }).toArray();
|
||||||
|
|
||||||
if (!ObjectId.isValid(planId)) {
|
if (!ObjectId.isValid(planId)) {
|
||||||
req.session.errMessage = "Invalid plan ID format.";
|
req.session.errMessage = "Invalid plan ID format.";
|
||||||
return res.status(status.BadRequest).redirect('/plans');
|
return res.status(status.BadRequest).redirect('/plans');
|
||||||
}
|
}
|
||||||
|
|
||||||
const plan = await plans.findOne({ userEmail: req.user.email, _id: new ObjectId(planId) });
|
const plan = await plans.findOne({ userId: new ObjectId(req.session.userId), _id: new ObjectId(planId) });
|
||||||
|
|
||||||
if (!plan) {
|
if (!plan) {
|
||||||
console.log(`Plan not found with ID: ${planId} for user: ${req.user.email}`);
|
console.log(`Plan not found with ID: ${planId} for user: ${req.session.userId}`);
|
||||||
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);
|
|
||||||
res.render('planDetail', {
|
res.render('planDetail', {
|
||||||
user: req.user,
|
user: req.session.user,
|
||||||
plan: plan
|
plan: plan,
|
||||||
|
geoData: req.session.geoData,
|
||||||
|
assets: userAssets,
|
||||||
|
suggestions: await suggestions.generateSuggestions(),
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -111,23 +156,20 @@ module.exports = (middleware, users, plans) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.get('/newPlan', (req, res) => {
|
router.get('/newPlan', (req, res) => {
|
||||||
if (!req.session.email) {
|
if (!req.session.user.financialData || !req.session.user) {
|
||||||
return res.status(status.Unauthorized).redirect('/login');
|
|
||||||
}
|
|
||||||
if(!req.user.financialData){
|
|
||||||
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');
|
||||||
}
|
}
|
||||||
const errMessage = req.session.errMessage;
|
const errMessage = req.session.errMessage;
|
||||||
req.session.errMessage = "";
|
req.session.errMessage = "";
|
||||||
res.render('newPlan', { user: req.user, errMessage: errMessage });
|
res.render('newPlan', {
|
||||||
|
user: req.session.user,
|
||||||
|
errMessage: errMessage,
|
||||||
|
geoData: req.session.geoData
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post('/newPlan', async (req, res) => {
|
router.post('/newPlan', async (req, res) => {
|
||||||
if (!req.session.email) {
|
|
||||||
return res.status(status.Unauthorized).redirect('/login');
|
|
||||||
}
|
|
||||||
|
|
||||||
const planSchema = joi.object({
|
const planSchema = joi.object({
|
||||||
name: joi.string().min(3).max(100).required(),
|
name: joi.string().min(3).max(100).required(),
|
||||||
retirementAge: joi.number().min(18).max(120).required(),
|
retirementAge: joi.number().min(18).max(120).required(),
|
||||||
@@ -146,17 +188,17 @@ module.exports = (middleware, users, plans) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const newPlan = {
|
const newPlan = {
|
||||||
userEmail: req.user.email,
|
userId: new ObjectId(req.session.userId),
|
||||||
name: value.name,
|
name: value.name,
|
||||||
retirementAge: value.retirementAge,
|
retirementAge: value.retirementAge,
|
||||||
retirementExpenses: value.retirementExpenses,
|
retirementExpenses: value.retirementExpenses,
|
||||||
retirementAssets: value.retirementAssets,
|
retirementAssets: value.retirementAssets,
|
||||||
retirementLiabilities: value.retirementLiabilities,
|
retirementLiabilities: value.retirementLiabilities,
|
||||||
progress: "0%"
|
progress: "0"
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await plans.insertOne(newPlan);
|
await plans.insertOne({ userId: new ObjectId(req.session.userId), ...newPlan });
|
||||||
req.session.errMessage = "";
|
req.session.errMessage = "";
|
||||||
res.redirect('/plans');
|
res.redirect('/plans');
|
||||||
}
|
}
|
||||||
@@ -167,30 +209,48 @@ module.exports = (middleware, users, plans) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.post('/fact', async (req, res) => {
|
||||||
|
const factInput = req.body.fact;
|
||||||
|
const fact = await suggestions.generateFact(factInput);
|
||||||
|
return res.status(status.Ok).json({ fact });
|
||||||
|
});
|
||||||
|
|
||||||
router.get('/more', (req, res) => {
|
router.get('/more', (req, res) => {
|
||||||
res.render('more', { user: req.user });
|
res.render('more', {
|
||||||
|
user: req.session.user,
|
||||||
|
geoData: req.session.geoData
|
||||||
|
});
|
||||||
return res.status(status.Ok);
|
return res.status(status.Ok);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/profile', (req, res) => {
|
router.get('/profile', (req, res) => {
|
||||||
res.render('profile', { user: req.user, errMessage: req.session.errMessage });
|
res.render('profile', {
|
||||||
|
user: req.session.user,
|
||||||
|
errMessage: req.session.errMessage,
|
||||||
|
geoData: req.session.geoData
|
||||||
|
});
|
||||||
return res.status(status.Ok);
|
return res.status(status.Ok);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/settings', (req, res) => {
|
router.get('/settings', (req, res) => {
|
||||||
res.render('settings', { user: req.user });
|
res.render('settings', {
|
||||||
|
user: req.session.user,
|
||||||
|
geoData: req.session.geoData
|
||||||
|
});
|
||||||
return res.status(status.Ok);
|
return res.status(status.Ok);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/questionnaire', (req, res) => {
|
router.get('/questionnaire', (req, res) => {
|
||||||
const errMessage = req.session.errMessage;
|
const errMessage = req.session.errMessage;
|
||||||
req.session.errMessage = "";
|
req.session.errMessage = "";
|
||||||
res.render('questionnaire', { user: req.user, errMessage: errMessage });
|
res.render('questionnaire', {
|
||||||
|
user: req.session.user,
|
||||||
|
errMessage: errMessage,
|
||||||
|
geoData: req.session.geoData
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
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(),
|
||||||
@@ -204,15 +264,17 @@ module.exports = (middleware, users, plans) => {
|
|||||||
const validationOptions = { convert: true, abortEarly: false };
|
const validationOptions = { convert: true, abortEarly: false };
|
||||||
const { error, value } = questionnaireSchema.validate(req.body, validationOptions);
|
const { error, value } = questionnaireSchema.validate(req.body, validationOptions);
|
||||||
|
|
||||||
|
let referrer = req.get('Referrer') || "/home";
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error("Questionnaire validation error:", error.details);
|
console.error("Questionnaire validation error:", error.details);
|
||||||
req.session.errMessage = "Invalid input: " + error.details.map(d => d.message.replace(/"/g, '')).join(', ');
|
req.session.errMessage = "Invalid input: " + error.details.map(d => d.message.replace(/"/g, '')).join(', ');
|
||||||
res.status(status.BadRequest).redirect("/questionnaire");
|
let redirect = referrer.includes("?profile") ? "/questionnaire?profile" : "/questionnaire";
|
||||||
|
res.status(status.BadRequest).redirect(redirect);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
users.updateOne(
|
users.updateOne(
|
||||||
{ email: req.session.email },
|
{ _id: new ObjectId(req.session.userId) },
|
||||||
{
|
{
|
||||||
$set: {
|
$set: {
|
||||||
financialData: true,
|
financialData: true,
|
||||||
@@ -227,31 +289,52 @@ module.exports = (middleware, users, plans) => {
|
|||||||
}
|
}
|
||||||
).then((result) => {
|
).then((result) => {
|
||||||
if (result.matchedCount === 0) {
|
if (result.matchedCount === 0) {
|
||||||
console.log(`User not found during questionnaire update: ${req.session.email}`);
|
console.log(`User not found during questionnaire update: ${req.session.userId}`);
|
||||||
req.session.errMessage = "User session invalid. Please log in again.";
|
req.session.errMessage = "User session invalid. Please log in again.";
|
||||||
res.status(status.NotFound).redirect("/login");
|
res.status(status.NotFound).redirect("/login");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (result.modifiedCount === 0 && result.matchedCount === 1) {
|
if (result.modifiedCount === 0 && result.matchedCount === 1) {
|
||||||
console.log(`User questionnaire data unchanged (already up-to-date): ${req.session.email}`);
|
console.log(`User questionnaire data unchanged (already up-to-date): ${req.session.userId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
req.session.errMessage = "";
|
req.session.errMessage = "";
|
||||||
res.status(status.Ok).redirect("/home");
|
req.session.user = null; // set user to null so middleware updates user
|
||||||
|
req.session.save((err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error("Failed to save session: ", err);
|
||||||
|
|
||||||
|
return req.session.destroy((err) => {
|
||||||
|
req.session.errMessage = "Failed to save session, please login again.";
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
console.error("Failed to destroy session: ", err);
|
||||||
|
}
|
||||||
|
|
||||||
|
res.status(status.InternalServerError);
|
||||||
|
return res.redirect("/login");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let redirect = referrer.includes("?profile") ? "/profile" :
|
||||||
|
referrer != "/home" ? "/plans" : referrer;
|
||||||
|
return res.status(status.Ok).redirect(redirect);
|
||||||
|
});
|
||||||
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error("Error updating questionnaire in database:", err);
|
console.error("Error updating questionnaire in database:", err);
|
||||||
req.session.errMessage = "An error occurred while saving your information. Please try again.";
|
req.session.errMessage = "An error occurred while saving your information. Please try again.";
|
||||||
res.status(status.InternalServerError).redirect("/questionnaire");
|
let redirect = referrer.includes("?profile") ? "/questionnaire?profile" : "/questionnaire";
|
||||||
|
res.status(status.InternalServerError).redirect(redirect);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
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);
|
||||||
@@ -263,7 +346,7 @@ module.exports = (middleware, users, plans) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let update = {
|
let update = {
|
||||||
// email: req.body.email,
|
email: req.body.email,
|
||||||
name: req.body.name,
|
name: req.body.name,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -277,21 +360,39 @@ module.exports = (middleware, users, plans) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
users.updateOne(
|
users.updateOne(
|
||||||
{ email: req.session.email },
|
{ _id: new ObjectId(req.session.userId) },
|
||||||
{ $set: update }
|
{ $set: update }
|
||||||
).then((result) => {
|
).then((result) => {
|
||||||
if (result.matchedCount === 0) {
|
if (result.matchedCount === 0) {
|
||||||
console.log(`User not found during account update: ${req.session.email}`);
|
console.log(`User not found during account update: ${req.session.userId}`);
|
||||||
req.session.errMessage = "User session invalid. Please log in again.";
|
req.session.errMessage = "User session invalid. Please log in again.";
|
||||||
res.status(status.NotFound).redirect("/login");
|
res.status(status.NotFound).redirect("/login");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (result.modifiedCount === 0 && result.matchedCount === 1) {
|
if (result.modifiedCount === 0 && result.matchedCount === 1) {
|
||||||
console.log(`User account data unchanged (already up-to-date): ${req.session.email}`);
|
console.log(`User account data unchanged (already up-to-date): ${req.session.userId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
req.session.errMessage = "";
|
req.session.errMessage = "";
|
||||||
|
req.session.user = null; // set user to null so middleware updates user
|
||||||
|
req.session.save((err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error("Failed to save session: ", err);
|
||||||
|
|
||||||
|
return req.session.destroy((err) => {
|
||||||
|
req.session.errMessage = "Failed to save session, please login again.";
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
console.error("Failed to destroy session: ", err);
|
||||||
|
}
|
||||||
|
|
||||||
|
res.status(status.InternalServerError);
|
||||||
|
return res.redirect("/login");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return res.status(status.Ok).redirect("/profile");
|
return res.status(status.Ok).redirect("/profile");
|
||||||
|
});
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error("Error updating account in database:", err);
|
console.error("Error updating account in database:", err);
|
||||||
req.session.errMessage = "An error occurred while saving your information. Please try again.";
|
req.session.errMessage = "An error occurred while saving your information. Please try again.";
|
||||||
@@ -299,19 +400,273 @@ module.exports = (middleware, users, plans) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.post("/updatePersonal", (req, res) => {
|
||||||
|
const questionnaireSchema = joi.object({
|
||||||
|
dob: joi.date().required(),
|
||||||
|
education: joi.string().valid('primary', 'secondary', 'tertiary', 'postgraduate').required(),
|
||||||
|
maritalStatus: joi.string().valid('single', 'married', 'divorced', 'widowed').required(),
|
||||||
|
income: joi.number().min(0).required(),
|
||||||
|
expenses: joi.number().min(0).required(),
|
||||||
|
assets: joi.number().min(0).required(),
|
||||||
|
liabilities: joi.number().min(0).required(),
|
||||||
|
});
|
||||||
|
|
||||||
|
const validationOptions = { convert: true, abortEarly: false };
|
||||||
|
const { error, value } = questionnaireSchema.validate(req.body, validationOptions);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
console.error("Personal info validation error:", error.details);
|
||||||
|
req.session.errMessage = "Invalid input: " + error.details.map(d => d.message.replace(/"/g, '')).join(', ');
|
||||||
|
res.status(status.BadRequest).redirect("/profile");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
users.updateOne(
|
||||||
|
{ _id: new ObjectId(req.session.userId) },
|
||||||
|
{
|
||||||
|
$set: {
|
||||||
|
financialData: true,
|
||||||
|
dob: value.dob,
|
||||||
|
education: value.education,
|
||||||
|
maritalStatus: value.maritalStatus,
|
||||||
|
income: value.income,
|
||||||
|
expenses: value.expenses,
|
||||||
|
assets: value.assets,
|
||||||
|
liabilities: value.liabilities,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).then((result) => {
|
||||||
|
if (result.matchedCount === 0) {
|
||||||
|
console.log(`User not found during personal info update: ${req.session.userId}`);
|
||||||
|
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 personal info unchanged (already up-to-date): ${req.session.userId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
req.session.errMessage = "";
|
||||||
|
req.session.user = null; // set user to null so middleware updates user
|
||||||
|
req.session.save((err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error("Failed to save session: ", err);
|
||||||
|
|
||||||
|
return req.session.destroy((err) => {
|
||||||
|
req.session.errMessage = "Failed to save session, please login again.";
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
console.error("Failed to destroy session: ", err);
|
||||||
|
}
|
||||||
|
|
||||||
|
res.status(status.InternalServerError);
|
||||||
|
return res.redirect("/login");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return res.status(status.Ok).redirect("/profile");
|
||||||
|
});
|
||||||
|
|
||||||
|
}).catch(err => {
|
||||||
|
console.error("Error updating personal info in database:", err);
|
||||||
|
req.session.errMessage = "An error occurred while saving your information. Please try again.";
|
||||||
|
res.status(status.InternalServerError).redirect("/profile");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post("/createAsset", (req, res) => {
|
||||||
|
// Create asset, each asset has different data structure based on type
|
||||||
|
const type = req.body.type;
|
||||||
|
const assetSchema = getAssetSchema(type);
|
||||||
|
|
||||||
|
if (!assetSchema) {
|
||||||
|
console.error("Modified asset type, rejected");
|
||||||
|
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);
|
||||||
|
return res.redirect("/assets");
|
||||||
|
}
|
||||||
|
|
||||||
|
let newAsset = {
|
||||||
|
userId: new ObjectId(req.session.userId),
|
||||||
|
...req.body,
|
||||||
|
updatedAt: new Date(),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (type == "stock") {
|
||||||
|
newAsset.quantity = parseInt(newAsset.quantity);
|
||||||
|
newAsset.price = parseFloat(newAsset.price)
|
||||||
|
newAsset.value = newAsset.quantity * newAsset.price;
|
||||||
|
newAsset.name = `${newAsset.ticker} Stock`;
|
||||||
|
}
|
||||||
|
newAsset.value = parseFloat(newAsset.value);
|
||||||
|
newAsset.icon = type == "stock" ? "Stock" : type == "saving" ? "Coins" : newAsset.icon;
|
||||||
|
|
||||||
|
assets.insertOne(newAsset, (err, _) => {
|
||||||
|
if (err) {
|
||||||
|
console.error("Error creating asset: ", err);
|
||||||
|
req.session.errMessage = "Internal server error";
|
||||||
|
return res.status(status.InternalServerError).redirect("/assets");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
req.session.errMessage = "";
|
||||||
|
return res.status(status.Ok).redirect("/assets");
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post("/updateAsset", (req, res) => {
|
||||||
|
const type = req.body.type;
|
||||||
|
const assetSchema = getAssetSchema(type);
|
||||||
|
|
||||||
|
if (!assetSchema) {
|
||||||
|
console.error("Modified asset type, rejected");
|
||||||
|
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);
|
||||||
|
return res.redirect("/assets");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.body.userId != req.session.userId) {
|
||||||
|
req.session.errMessage = "Cannot change asset owner",
|
||||||
|
res.status(status.BadRequest);
|
||||||
|
return res.redirect("/assets");
|
||||||
|
}
|
||||||
|
|
||||||
|
let update = { ...req.body, updatedAt: new Date() };
|
||||||
|
if (type == "stock") {
|
||||||
|
update.quantity = parseInt(update.quantity);
|
||||||
|
update.price = parseFloat(update.price)
|
||||||
|
update.value = update.quantity * update.price;
|
||||||
|
update.name = `${update.ticker} Stock`;
|
||||||
|
}
|
||||||
|
update.value = parseFloat(update.value);
|
||||||
|
delete update.id;
|
||||||
|
delete update.userId;
|
||||||
|
|
||||||
|
assets.updateOne(
|
||||||
|
{ "_id": new ObjectId(req.body.id) },
|
||||||
|
{ $set: update },
|
||||||
|
).then((result) => {
|
||||||
|
if (result.matchedCount === 0) {
|
||||||
|
console.log(`Asset not found: ${req.body.id}`);
|
||||||
|
req.session.errMessage = "Unable to update asset";
|
||||||
|
return res.status(status.NotFound).redirect("/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) => {
|
||||||
|
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");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post("/deleteAsset", (req, res) => {
|
||||||
|
const id = new ObjectId(req.body.id);
|
||||||
|
|
||||||
|
assets.deleteOne(
|
||||||
|
{ "_id": id }
|
||||||
|
).then((result) => {
|
||||||
|
if (result.deletedCount === 0) {
|
||||||
|
console.error(`Asset not found: ${req.body.id}`);
|
||||||
|
req.session.errMessage = "Unable to delete asset. Please try again.";
|
||||||
|
return res.status(status.NotFound).redirect("/assets");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!result.acknowledged) {
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post("/deleteUser", (req, res) => {
|
||||||
|
// not as critical if results aren't as expected only if crashing
|
||||||
|
assets.deleteMany({ userId: new ObjectId(req.session.userId) }).catch((err) => {
|
||||||
|
console.error("Error deleting user assets: ", err);
|
||||||
|
req.session.errMessage = "An error occured while deleting your account. Please try again.";
|
||||||
|
return res.status(status.InternalServerError).redirect("/profile");
|
||||||
|
});
|
||||||
|
|
||||||
|
plans.deleteMany({ userId: new ObjectId(req.session.userId) }).catch((err) => {
|
||||||
|
console.error("Error deleting user assets: ", err);
|
||||||
|
req.session.errMessage = "An error occured while deleting your account. Please try again.";
|
||||||
|
return res.status(status.InternalServerError).redirect("/profile");
|
||||||
|
});
|
||||||
|
|
||||||
|
users.deleteOne(
|
||||||
|
{ _id: new ObjectId(req.session.userId) },
|
||||||
|
).then((result) => {
|
||||||
|
if (result.deletedCount === 0) {
|
||||||
|
console.error(`User not found: ${req.body.id}`);
|
||||||
|
req.session.errMessage = "Unabled to delete account. Please try again.";
|
||||||
|
return res.status(status.NotFound).redirect("/profile");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!result.acknowledged) {
|
||||||
|
console.error("Error deleting user: ", err);
|
||||||
|
req.session.errMessage = "An error occured while deleting your account. Please try again.";
|
||||||
|
return res.status(status.InternalServerError).redirect("/profile");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Direct to logout to destroy session
|
||||||
|
req.session.destroy();
|
||||||
|
return res.status(status.Ok).redirect("/signup");
|
||||||
|
}).catch((err) => {
|
||||||
|
console.error("Error deleting user: ", err);
|
||||||
|
req.session.errMessage = "An error occured while deleting your account. Please try again.";
|
||||||
|
return res.status(status.InternalServerError).redirect("/profile");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
router.get("/exRates/:lat/:lon", async (req, res) => {
|
router.get("/exRates/:lat/:lon", async (req, res) => {
|
||||||
if (!req.session.geoData.country) {
|
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 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();
|
const data = await response.json();
|
||||||
|
|
||||||
country = data.results[0].formatted_address;
|
country = data.results[0].formatted_address;
|
||||||
let results = await getRates(country);
|
let results = await getRates(country);
|
||||||
|
|
||||||
|
if (!results.exRates) {
|
||||||
|
req.session.geoData = {
|
||||||
|
message: "error"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
req.session.geoData = {
|
req.session.geoData = {
|
||||||
country: results.abbreviation,
|
country: results.abbreviation,
|
||||||
toCurrencyRates: results.exRates
|
toCurrencyRates: results.exRates,
|
||||||
|
geoData: req.session.geoData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return res.status(status.Ok).send({ data: req.session.geoData });
|
return res.status(status.Ok).send({ data: req.session.geoData });
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
const ObjectId = require('mongodb').ObjectId;
|
||||||
|
|
||||||
|
async function calculatePlanProgress(plans, assets, userId) {
|
||||||
|
if (!plans || typeof plans.retirementAssets === 'undefined') {
|
||||||
|
console.error("Invalid plan document provided to calculatePlanProgress:", plans);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (!assets || typeof assets.find !== 'function') {
|
||||||
|
console.error("Invalid assetsCollection provided to calculatePlanProgress");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const userAssets = await assets.find({ userId: new ObjectId(userId) }).toArray();
|
||||||
|
const totalUserAssetValue = userAssets.reduce((total, asset) => total + asset.value, 0);
|
||||||
|
let percentage = 0;
|
||||||
|
|
||||||
|
if (plans.retirementAssets > 0) {
|
||||||
|
percentage = (totalUserAssetValue / plans.retirementAssets) * 100;
|
||||||
|
}
|
||||||
|
return percentage;
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Error in calculatePlanProgress:", err);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function updatePlanProgressInDB(planId, percentage, plans) {
|
||||||
|
if (!plans || typeof plans.updateOne !== 'function') {
|
||||||
|
console.error("Error with the plans collection");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (typeof percentage !== 'number' || isNaN(percentage)) {
|
||||||
|
console.error(`Error with the percentage: ${percentage}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await plans.updateOne({ _id: new ObjectId(planId) }, { $set: { progress: parseFloat(percentage.toFixed(2)) } });
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Error in updatePlanProgressInDB:", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { calculatePlanProgress, updatePlanProgressInDB };
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
const { GoogleGenAI } = require("@google/genai");
|
||||||
|
|
||||||
|
const ai = new GoogleGenAI({ apiKey: process.env.GOOGLE_API_KEY });
|
||||||
|
|
||||||
|
async function generateFact(factInput) {
|
||||||
|
const response = await ai.models.generateContent({
|
||||||
|
model: "gemini-2.0-flash",
|
||||||
|
contents: `Generate a concise investment fact about "${factInput}". If "${factInput}" is not directly investment-related, provide a general, useful investment fact instead. Deliver only the fact itself, with no extra text or explanation.`,
|
||||||
|
});
|
||||||
|
return response.text;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function generateSuggestions() {
|
||||||
|
const response = await ai.models.generateContent({
|
||||||
|
model: "gemini-2.0-flash",
|
||||||
|
contents: "Return a mock investment suggestion 3-5 lines only",
|
||||||
|
});
|
||||||
|
return response.text;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
generateFact,
|
||||||
|
generateSuggestions
|
||||||
|
};
|
||||||
@@ -2,8 +2,71 @@
|
|||||||
<%- include("./partials/header") %>
|
<%- include("./partials/header") %>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
The Assets Page
|
<%- include("./partials/createAsset", { icons: icons }) %>
|
||||||
|
|
||||||
|
<% if (errMessage != "") { %>
|
||||||
|
<div class="max-w-md mx-auto mb-10 rounded-lg shadow-md text-white font-bold bg-red-400 py-4 text-center"><%= errMessage %></div>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
<!-- Main display -->
|
||||||
|
<section>
|
||||||
|
<div class="mt-8 max-w-md mx-auto bg-white px-8 py-6 rounded-lg shadow-md flex flex-col justify-center">
|
||||||
|
<div class="flex flex-row justify-between text-right">
|
||||||
|
<h1 class="text-2xl font-bold tracking-tight leading-none">Assets:</h1>
|
||||||
|
<h1 class="text-xl font-medium tracking-tight leading-none"><%= assets.length %></h1>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-row justify-between text-right mt-6">
|
||||||
|
<h1 class="text-2xl font-bold tracking-tight leading-none">Total Value:</h1>
|
||||||
|
<h1 class="text-xl font-medium tracking-tight leading-none">
|
||||||
|
<!-- sum of assets array values and formated as proper dollar amount -->
|
||||||
|
$<%= assets.reduce((total, e) => total + e.value, 0).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}) %>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="w-md my-6 max-w-md mx-auto px-4 flex flex-row justify-between">
|
||||||
|
<a href="/home" class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
|
||||||
|
Back to Dashboard
|
||||||
|
</a>
|
||||||
|
<button
|
||||||
|
class="text-center w-sm py-2 py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
|
||||||
|
onclick="document.getElementById('create-asset-modal').showModal()"
|
||||||
|
>
|
||||||
|
Add New Asset
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<hr class="h-px my-8 bg-gray-500 border-0 mx-10">
|
||||||
|
|
||||||
|
<!-- list each asset and create hidden popup modal for view/edit -->
|
||||||
|
<section class="mt-6">
|
||||||
|
<% if (assets.length == 0) { %>
|
||||||
|
<div class="max-w-md mx-auto mb-10 rounded-lg shadow-md text-white font-bold bg-red-400 py-4 text-center">
|
||||||
|
You have no assets, create a new asset.
|
||||||
|
</div>
|
||||||
|
<% } %>
|
||||||
|
<% assets.forEach((asset) => { %>
|
||||||
|
<%- include("./partials/assetPreview", { asset: asset }); %>
|
||||||
|
|
||||||
|
<%- include("./partials/assetDelete", { asset: asset }); %>
|
||||||
|
|
||||||
|
<%- include("./partials/assetModify", { asset: asset }); %>
|
||||||
|
<% }) %>
|
||||||
|
</section>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<div class="mt-20"></div>
|
||||||
|
|
||||||
|
<script src="/static/scripts/assetManager.js"></script>
|
||||||
|
<script>
|
||||||
|
// Ensure all assets popup modals are locked and reset on page load
|
||||||
|
let assets = <%- JSON.stringify(assets) %>;
|
||||||
|
assets.forEach((asset) => {
|
||||||
|
lockAsset(asset._id, asset.icon);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<%- include("./partials/navBar") %>
|
<%- include("./partials/navBar") %>
|
||||||
|
<%- include("./partials/scriptLoader") %>
|
||||||
<%- include("./partials/footer") %>
|
<%- include("./partials/footer") %>
|
||||||
@@ -2,13 +2,22 @@
|
|||||||
<%- include("./partials/header") %>
|
<%- include("./partials/header") %>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<h2 class="text-xl text-white font-semibold mb-4">Welcome: <%= user.name %></h2>
|
|
||||||
<!-- Buttons -->
|
<!-- Buttons -->
|
||||||
<div class="flex justify-end gap-4 px-5 py-6">
|
<div class="flex justify-end gap-4 px-5 py-6">
|
||||||
<button class="cursor-pointer min-w-[150px] bg-green-600 px-4 py-2 text-white rounded hover:bg-green-800" type="button">Add Asset</button>
|
<a href="/assets?popup"
|
||||||
<a href="/newPlan" class="cursor-pointer min-w-[150px] bg-green-600 px-4 py-2 text-white rounded hover:bg-green-800" type="button">Create new plan </a>
|
class="text-center cursor-pointer min-w-[150px] bg-green-600 px-4 py-2 text-white rounded hover:bg-green-800"
|
||||||
|
type="button">Add Asset</a>
|
||||||
|
<a href="/newPlan"
|
||||||
|
class="text-center cursor-pointer min-w-[150px] bg-green-600 px-4 py-2 text-white rounded hover:bg-green-800"
|
||||||
|
type="button">Create new plan </a>
|
||||||
</div>
|
</div>
|
||||||
<!--This is the cards for plans and other things-->
|
<!--This is the cards for plans and other things-->
|
||||||
|
<div class="mt-12">
|
||||||
|
<!--box to put logo icon if we want on in a box-->
|
||||||
|
<!-- <div -->
|
||||||
|
<!-- class="bg-clip-border mx-4 rounded-xl overflow-hidden bg-gradient-to-tr from-blue-600 to-blue-400 text-white shadow-blue-500/40 shadow-lg absolute mt-2 grid h-16 w-16 place-items-center"> -->
|
||||||
|
<!-- </div> -->
|
||||||
|
<!--This is the cards for plans and other things-->
|
||||||
<div class="mt-12">
|
<div class="mt-12">
|
||||||
<div class="mb-12 grid gap-y-10 gap-x-6 md:grid-cols-2 mr-3 ml-3 xl:grid-cols-4">
|
<div class="mb-12 grid gap-y-10 gap-x-6 md:grid-cols-2 mr-3 ml-3 xl:grid-cols-4">
|
||||||
<!--box to put logo icon if we want on in a box-->
|
<!--box to put logo icon if we want on in a box-->
|
||||||
@@ -24,8 +33,11 @@
|
|||||||
$53k</h4>
|
$53k</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="border-t border-blue-gray-50 p-10">
|
<div class="border-t border-blue-gray-50 p-10">
|
||||||
<p class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
|
<p
|
||||||
<strong class="text-green-500">Make this percent bar or graph or something </strong> than lastweek
|
class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
|
||||||
|
<strong class="text-green-500">Make this percent bar or graph or
|
||||||
|
something
|
||||||
|
</strong> than lastweek
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -38,8 +50,11 @@
|
|||||||
$53k</h4>
|
$53k</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="border-t border-blue-gray-50 p-10">
|
<div class="border-t border-blue-gray-50 p-10">
|
||||||
<p class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
|
<p
|
||||||
<strong class="text-green-500">Make this percent bar or graph or something </strong> than last
|
class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
|
||||||
|
<strong class="text-green-500">Make this percent bar or graph or
|
||||||
|
something
|
||||||
|
</strong> than last
|
||||||
week
|
week
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -68,8 +83,10 @@
|
|||||||
<!-- </p> -->
|
<!-- </p> -->
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
<div class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
|
<div
|
||||||
<div class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
|
class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
|
||||||
|
<div
|
||||||
|
class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
|
||||||
<div class="p-4 flex items-center justify-between">
|
<div class="p-4 flex items-center justify-between">
|
||||||
<p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600">
|
<p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600">
|
||||||
Retirement goal</p>
|
Retirement goal</p>
|
||||||
@@ -78,8 +95,11 @@
|
|||||||
$53k</h4>
|
$53k</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="border-t border-blue-gray-50 p-10">
|
<div class="border-t border-blue-gray-50 p-10">
|
||||||
<p class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
|
<p
|
||||||
<strong class="text-green-500">Make this percent bar or graph or something </strong> than last
|
class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
|
||||||
|
<strong class="text-green-500">Make this percent bar or
|
||||||
|
graph or something
|
||||||
|
</strong> than last
|
||||||
week
|
week
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -91,15 +111,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<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/calcExchange.js"></script> -->
|
|
||||||
<script>
|
|
||||||
// If no geoData provided thorugh EJS, send update request to backend
|
|
||||||
let country = "<%= geoData.country %>";
|
|
||||||
if (!country) getLocation();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
<%- include("./partials/navBar") %>
|
<%- include("./partials/navBar") %>
|
||||||
|
<%- 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") %>
|
||||||
@@ -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">
|
||||||
|
|||||||
@@ -6,5 +6,6 @@
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<%- include("./partials/navBar") %>
|
<%- include("./partials/navBar") %>
|
||||||
|
<%- include("./partials/scriptLoader") %>
|
||||||
<%- include("./partials/footer") %>
|
<%- include("./partials/footer") %>
|
||||||
|
|
||||||
@@ -37,4 +37,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<%- include("./partials/navBar") %>
|
||||||
|
<%- include("./partials/scriptLoader") %>
|
||||||
<%- include("./partials/footer") %>
|
<%- include("./partials/footer") %>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<%- include("./partials/fileHeader") %>
|
||||||
|
<%- include("./partials/headerStart") %>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<section class="bg-center bg-no-repeat bg-cover bg-[url('/images/bg1.jpg')] bg-gray-400 bg-blend-multiply">
|
||||||
|
<div class="px-4 mx-auto max-w-screen-xl text-center py-24 lg:py-56">
|
||||||
|
<h1 class="mb-4 text-4xl font-extrabold tracking-tight leading-none text-white md:text-5xl lg:text-6xl">404 - Not found</h1>
|
||||||
|
<p class="mb-8 text-lg font-normal text-gray-300 lg:text-xl sm:px-16 lg:px-48">It appears you stumbled accross a misleading page.</p>
|
||||||
|
<div class="flex flex-col space-y-4 sm:flex-row sm:justify-center sm:space-y-0">
|
||||||
|
<a href="/" class="inline-flex justify-center items-center py-3 px-5 text-base font-medium text-center text-white rounded-lg bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-900">
|
||||||
|
Go home
|
||||||
|
<svg class="w-3.5 h-3.5 ms-2 rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10">
|
||||||
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 5h12m0 0L9 1m4 4L9 9"/>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
<a href="/aboutUs" class="inline-flex justify-center hover:text-gray-900 items-center py-3 px-5 sm:ms-4 text-base font-medium text-center text-white rounded-lg border border-white hover:bg-gray-100 focus:ring-4 focus:ring-gray-400">
|
||||||
|
Learn more
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<%- include("./partials/footer") %>
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<!-- Confirm delete asset modal -->
|
||||||
|
<dialog id="<%= asset._id %>-delete-modal" class="w-lg mx-auto bg-transparent p-8 mt-10 rounded-lg shadow-md">
|
||||||
|
<div class="relative p-4 w-full max-w-md h-full md:h-auto">
|
||||||
|
<!-- Modal content -->
|
||||||
|
<div class="relative p-4 text-center bg-white rounded-lg shadow dark:bg-gray-800 sm:p-5">
|
||||||
|
<form method="dialog">
|
||||||
|
<button type="submit" class="text-gray-400 absolute top-2.5 right-2.5 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white">
|
||||||
|
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
|
||||||
|
<span class="sr-only">Close modal</span>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<svg class="text-gray-400 dark:text-gray-500 w-11 h-11 mb-3.5 mx-auto" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z" clip-rule="evenodd"></path></svg>
|
||||||
|
<p class="mb-4 text-gray-500 dark:text-gray-300">Are you sure you want to delete this item?</p>
|
||||||
|
<div class="flex justify-center items-center space-x-4">
|
||||||
|
<div style="width: 100%;">
|
||||||
|
<form method="dialog" style="width: 100%;">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="py-2 px-3 text-sm font-medium text-gray-500 bg-white rounded-lg border border-gray-200 hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-primary-300 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"
|
||||||
|
>
|
||||||
|
No, cancel
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div style="width: 100%;">
|
||||||
|
<form method="POST" action="/deleteAsset">
|
||||||
|
<input id="id-delete-<%= asset._id %>" name="id" type="text" hidden value="<%= asset._id %>">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="py-2 px-3 text-sm font-medium text-center text-white bg-red-600 rounded-lg hover:bg-red-700 focus:ring-4 focus:outline-none focus:ring-red-300 dark:bg-red-500 dark:hover:bg-red-600 dark:focus:ring-red-900"
|
||||||
|
>
|
||||||
|
Yes, I'm sure
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</dialog>
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
|
||||||
|
<!-- View/edit popup modal for asset -->
|
||||||
|
<dialog id="<%= asset._id %>-modal" class="w-lg mx-auto bg-white p-8 mt-10 rounded-lg shadow-md">
|
||||||
|
<div class="flex flex-row justify-between">
|
||||||
|
<div style="width: 45%;">
|
||||||
|
<form method="dialog" style="width: 100%;">
|
||||||
|
<button
|
||||||
|
style="width: 100%;"
|
||||||
|
onclick="lockAsset('<%= asset._id %>', '<%= asset.icon %>')"
|
||||||
|
type="submit"
|
||||||
|
class="text-center w-sm py-2 py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
|
||||||
|
>
|
||||||
|
Close
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div style="width: 45%;">
|
||||||
|
<button
|
||||||
|
style="width: 100%;"
|
||||||
|
type="submit"
|
||||||
|
class="text-center w-sm py-2 py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 cursor-pointer"
|
||||||
|
onclick="document.getElementById('<%= asset._id %>-delete-modal').showModal()"
|
||||||
|
>
|
||||||
|
Delete
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div class="flex flex-row justify-between">
|
||||||
|
<% if (asset.type == "other") { %>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<button id="dropdown-icon-button-<%= asset._id %>" value="" data-dropdown-toggle="dropdown-icons-<%= asset._id %>" class="shrink-0 z-10 inline-flex items-center py-2.5 px-4 text-sm font-medium text-center 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" type="button">
|
||||||
|
<img src="/static/svgs/icons/<%= asset.icon %>.svg" class="h-4 w-4 me-2" alt="<%= asset.icon %>"> <%= asset.icon %>
|
||||||
|
<svg class="w-2.5 h-2.5 ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
|
||||||
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<div id="dropdown-icons-<%= asset._id %>" class="overflow-y-auto h-40 z-10 hidden bg-white divide-y divide-gray-100 rounded-lg shadow-sm w-32 dark:bg-gray-700">
|
||||||
|
<ul id="dropdown-<%= asset._id %>" class="py-2 text-sm text-gray-700 dark:text-gray-200" aria-labelledby="dropdown-icon-button-<%= asset._id %>">
|
||||||
|
<% icons.forEach(icon => { %>
|
||||||
|
<li>
|
||||||
|
<button onclick="selectIcon(this, '<%= asset._id %>')" type="button" value="<%= icon %>" class="inline-flex w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-600 dark:hover:text-white" role="menuitem">
|
||||||
|
<span class="inline-flex items-center">
|
||||||
|
<img src="/static/svgs/icons/<%= icon %>.svg" class="h-4 w-4 me-2" alt="<%= icon %>"> (<%= icon %>)
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<% }); %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% } else { %>
|
||||||
|
<button disabled class="inline-flex items-center py-2.5 px-10 text-sm font-medium text-center 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" type="button">
|
||||||
|
<img src="/static/svgs/icons/<%= asset.icon %>.svg" class="h-4 w-4" alt="<%= asset.icon %>">
|
||||||
|
</button>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
<h2 class="text-xl font-medium tracking-tight leading-none mt-3"><%= String(asset.type).charAt(0).toUpperCase() + String(asset.type).slice(1); %> Asset</h2>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
id="edit-<%= asset._id %>"
|
||||||
|
onclick="unlockAsset('<%= asset._id %>')"
|
||||||
|
class="py-3 px-8 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
|
||||||
|
>
|
||||||
|
Edit
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<form id="<%= asset._id %>-form" method="POST" action="/updateAsset">
|
||||||
|
<input id="type-<%= asset._id %>" name="type" type="text" hidden value="<%= asset.type %>">
|
||||||
|
<input id="id-<%= asset._id %>" name="id" type="text" hidden value="<%= asset._id %>">
|
||||||
|
<input id="userId-<%= asset.userId %>" name="userId" type="text" hidden value="<%= asset.userId %>">
|
||||||
|
<input id="icon-<%= asset._id %>" name="icon" type="text" hidden value="<%= asset.icon %>">
|
||||||
|
|
||||||
|
<% if (asset.type != "stock") { %>
|
||||||
|
<label for="name" class="block text-sm font-medium text-gray-700 mt-6">Name</label>
|
||||||
|
<input id="name-<%= asset._id %>" disabled type="text" name="name" value="<%= asset.name %>" class="mt-1 mb-2 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">
|
||||||
|
<% } else { %>
|
||||||
|
<label for="ticker" class="block text-sm font-medium text-gray-700 mt-2">Stock Ticker</label>
|
||||||
|
<input id="ticker-<%= asset._id %>" disabled type="text" name="ticker" value="<%= asset.ticker %>" class="mt-1 mb-2 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">
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
<hr class="h-px mt-6 mb-4 bg-gray-500 border-0 mx-10">
|
||||||
|
|
||||||
|
<% if (asset.type != "stock") { %>
|
||||||
|
<label for="value" class="block text-sm font-medium text-gray-700">Value</label>
|
||||||
|
<input id="value-<%= asset._id %>" disabled type="number" name="value" value="<%= asset.value %>" 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">
|
||||||
|
<% } else { %>
|
||||||
|
<label for="price" class="block text-sm font-medium text-gray-700 mt-2">Price per Share</label>
|
||||||
|
<input id="price-<%= asset._id %>" disabled type="number" name="price" value="<%= asset.price %>" 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="quantity" class="block text-sm font-medium text-gray-700 mt-2">Quantity of Shares</label>
|
||||||
|
<input id="quantity-<%= asset._id %>" disabled type="number" name="quantity" value="<%= asset.quantity %>" 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">
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
<% if (asset.type == "other") { %>
|
||||||
|
<label for="description" class="block text-sm font-medium text-gray-700 mt-2">Description</label>
|
||||||
|
<textarea disabled maxlength="240" id="description-<%= asset._id %>" name="description" rows="4" cols="50" 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"><%= asset.description %></textarea>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
<% if (asset.type != "saving") { %>
|
||||||
|
<label for="purchaseDate" class="block text-sm font-medium text-gray-700 mt-2">Purchased on</label>
|
||||||
|
<input id="purchaseDate-<%= asset._id %>" disabled type="date" name="purchaseDate" value="<%= asset.purchaseDate %>" 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">
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<small class="block text-sm font-medium text-gray-700">Last Modified: <%= asset.updatedAt %></small>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button id="save-<%= asset._id %>" disabled type="submit" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-not-allowed">
|
||||||
|
Save
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</dialog>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<!-- Clickable asset list item -->
|
||||||
|
<div class="mt-4 max-w-md mx-auto bg-white rounded-lg shadow-md">
|
||||||
|
<button onclick="document.getElementById('<%= asset._id %>-modal').showModal()" style="width: 100%; height: 100%;" class="px-4 py-4 cursor-pointer">
|
||||||
|
<div class="flex flex-row justify-between">
|
||||||
|
<div class="flex flex-row justify-between">
|
||||||
|
<div class="mx-2">
|
||||||
|
<img src="/static/svgs/icons/<%= asset.icon %>.svg" class="h-6 w-6 me-2" alt="<%= asset.icon %>">
|
||||||
|
</div>
|
||||||
|
<div class="mx-2"><h3><%= asset.name %></h3></div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h3><strong>
|
||||||
|
$<%= asset.value.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}) %>
|
||||||
|
</strong></h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
<!-- Create Asset popup Modal -->
|
||||||
|
<dialog id="create-asset-modal" class="w-lg mx-auto bg-white p-8 mt-10 rounded-lg shadow-md">
|
||||||
|
<div class="flex flex-row justify-between">
|
||||||
|
<h2 class="text-lg font-bold mb-2">Create New Asset</h2>
|
||||||
|
<form method="dialog">
|
||||||
|
<button
|
||||||
|
onclick="resetAll()"
|
||||||
|
type="submit"
|
||||||
|
class="text-center py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="my-4">
|
||||||
|
<label class="block text-sm font-medium text-gray-700">Asset Type</label>
|
||||||
|
<div class="mt-1 space-x-4">
|
||||||
|
<label class="inline-flex items-center">
|
||||||
|
<input checked onclick="selectAssetForm('create-other-asset-form')" id="asset-other" type="radio" name="type" value="other" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 cursor-pointer">
|
||||||
|
<span class="ml-2 text-sm text-gray-700">Other Assets</span>
|
||||||
|
</label>
|
||||||
|
<label class="inline-flex items-center">
|
||||||
|
<input onclick="selectAssetForm('create-saving-asset-form')" id="asset-saving" type="radio" name="type" value="saving" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 cursor-pointer">
|
||||||
|
<span class="ml-2 text-sm text-gray-700">Savings</span>
|
||||||
|
</label>
|
||||||
|
<label class="inline-flex items-center">
|
||||||
|
<input onclick="selectAssetForm('create-stock-asset-form')" id="asset-stock" type="radio" name="type" value="stock" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 cursor-pointer">
|
||||||
|
<span class="ml-2 text-sm text-gray-700">Stocks</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 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">
|
||||||
|
|
||||||
|
<label for="name" class="block text-sm font-medium text-gray-700 mt-2">Select an Icon</label>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<button id="dropdown-icon-button" value="" data-dropdown-toggle="dropdown-icons" class="shrink-0 z-10 inline-flex items-center py-2.5 px-4 text-sm font-medium text-center border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" type="button">
|
||||||
|
<img src="/static/svgs/icons/Other.svg" class="h-4 w-4 me-2" alt="Other"> Other
|
||||||
|
<svg class="w-2.5 h-2.5 ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
|
||||||
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<div id="dropdown-icons" class="overflow-y-auto h-40 z-10 hidden bg-white divide-y divide-gray-100 rounded-lg shadow-sm w-32 dark:bg-gray-700">
|
||||||
|
<ul id="dropdown" class="py-2 text-sm text-gray-700 dark:text-gray-200" aria-labelledby="dropdown-icon-button">
|
||||||
|
<% icons.forEach(icon => { %>
|
||||||
|
<li>
|
||||||
|
<button onclick="selectIcon(this)" type="button" value="<%= icon %>" class="inline-flex w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-600 dark:hover:text-white" role="menuitem">
|
||||||
|
<span class="inline-flex items-center">
|
||||||
|
<img src="/static/svgs/icons/<%= icon %>.svg" class="h-4 w-4 me-2" alt="<%= icon %>"> (<%= icon %>)
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
<% }); %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label for="name" class="block text-sm font-medium text-gray-700 mt-2">Asset Name</label>
|
||||||
|
<input required id="name" type="text" name="name" minlength="3" maxlength="30" 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">
|
||||||
|
|
||||||
|
<label for="value" class="block text-sm font-medium text-gray-700 mt-2">Asset Value</label>
|
||||||
|
<input required placeholder="CAD" min="0" id="value" type="number" name="value" 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">
|
||||||
|
|
||||||
|
<label for="purchaseDate" class="block text-sm font-medium text-gray-700 mt-2">Date of Purchase</label>
|
||||||
|
<input required type="date" id="purchaseDate" name="purchaseDate" 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">
|
||||||
|
|
||||||
|
<label for="description" class="block text-sm font-medium text-gray-700 mt-2">Description</label>
|
||||||
|
<textarea maxlength="240" id="description" name="description" rows="4" cols="50" 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"></textarea>
|
||||||
|
|
||||||
|
<div class="mt-6 flex flex-row justify-between">
|
||||||
|
<button
|
||||||
|
type="reset"
|
||||||
|
onclick="document.getElementById('create-other-asset-form').reset()"
|
||||||
|
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
|
||||||
|
>
|
||||||
|
Clear
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
|
||||||
|
>
|
||||||
|
Create
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<!-- Create savings asset form -->
|
||||||
|
<form style="display: none;" method="POST" action="/createAsset" id="create-saving-asset-form">
|
||||||
|
<input style="display: none;" value="saving" name="type" type="text">
|
||||||
|
|
||||||
|
<label for="name" class="block text-sm font-medium text-gray-700 mt-2">Savings Name</label>
|
||||||
|
<input required id="name" type="text" name="name" minlength="3" maxlength="30" 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">
|
||||||
|
|
||||||
|
<label for="value" class="block text-sm font-medium text-gray-700 mt-2">Savings Value</label>
|
||||||
|
<input required placeholder="CAD" min="0" id="value" type="number" name="value" 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">
|
||||||
|
|
||||||
|
<div class="mt-6 flex flex-row justify-between">
|
||||||
|
<button
|
||||||
|
type="reset"
|
||||||
|
onclick="document.getElementById('create-saving-asset-form').reset()"
|
||||||
|
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
|
||||||
|
>
|
||||||
|
Clear
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
|
||||||
|
>
|
||||||
|
Create
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<!-- Create stock asset form -->
|
||||||
|
<form style="display: none;" method="POST" action="/createAsset" id="create-stock-asset-form">
|
||||||
|
<input style="display: none;" value="stock" name="type" type="text">
|
||||||
|
|
||||||
|
<label for="ticker" class="block text-sm font-medium text-gray-700 mt-2">Stock Ticker</label>
|
||||||
|
<input required id="ticker" type="text" name="ticker" minlength="3" maxlength="5" 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">
|
||||||
|
|
||||||
|
<label for="price" class="block text-sm font-medium text-gray-700 mt-2">Price per Share</label>
|
||||||
|
<input required placeholder="CAD" min="0" id="price" type="number" name="price" 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">
|
||||||
|
|
||||||
|
<label for="quantity" class="block text-sm font-medium text-gray-700 mt-2">Quantity of Shares</label>
|
||||||
|
<input required type="number" min="1" id="quantity" name="quantity" 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">
|
||||||
|
|
||||||
|
<label for="purchaseDate" class="block text-sm font-medium text-gray-700 mt-2">Date of Purchase</label>
|
||||||
|
<input required type="date" id="purchaseDate" name="purchaseDate" 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">
|
||||||
|
|
||||||
|
<div class="mt-6 flex flex-row justify-between">
|
||||||
|
<button
|
||||||
|
type="reset"
|
||||||
|
onclick="document.getElementById('create-stock-asset-form').reset()"
|
||||||
|
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
|
||||||
|
>
|
||||||
|
Clear
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
|
||||||
|
>
|
||||||
|
Create
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</dialog>
|
||||||
@@ -1,3 +1,16 @@
|
|||||||
|
<div class="fixed end-6 bottom-20 group">
|
||||||
|
<div id="factMenu" class="absolute right-0 bottom-full mb-2 hidden">
|
||||||
|
<div id="factContainer" class="bg-white p-4 rounded-lg shadow-md dark:bg-gray-700 w-64">
|
||||||
|
<p class="mb-2 text-sm text-gray-700 dark:text-gray-300">Insert the kind of short fact you would like to know more about:</p>
|
||||||
|
<input type="text" id="factInput" placeholder="Enter your topic here" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-600 dark:border-gray-500 dark:text-white dark:placeholder-gray-400">
|
||||||
|
<button type="button" id="factSubmitButton" class="mt-3 w-full px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-700">Submit</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" id="factButton" class="flex items-center justify-center text-white bg-blue-700 rounded-full w-14 h-14 hover:bg-blue-800 dark:bg-blue-600 dark:hover:bg-blue-700 focus:ring-4 focus:ring-blue-300 focus:outline-none dark:focus:ring-blue-800">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"></path></svg>
|
||||||
|
<span class="sr-only">Get a Fact</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<footer class="mt-16">
|
<footer class="mt-16">
|
||||||
<div class="fixed bottom-0 left-0 z-50 hidden lg:block w-full h-16 bg-gray-800 border-t border-gray-700 p-6 text-center text-gray-400 text-sm">
|
<div class="fixed bottom-0 left-0 z-50 hidden lg:block w-full h-16 bg-gray-800 border-t border-gray-700 p-6 text-center text-gray-400 text-sm">
|
||||||
@@ -6,5 +19,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/flowbite@3.1.2/dist/flowbite.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
|
<script src="/static/scripts/footer.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -17,12 +17,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="display: none;" class="flex items-center" id="currencyExchange">
|
<div style="display: none;" class="flex items-center" id="currencyExchange">
|
||||||
<div 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-s-lg focus:ring-4 focus:outline-none focus:ring-gray-100 dark:bg-gray-700 dark:focus:ring-gray-700 dark:text-white dark:border-gray-600">
|
<div id="exFrom" 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-s-lg focus:ring-4 focus:outline-none focus:ring-gray-100 dark:bg-gray-700 dark:focus:ring-gray-700 dark:text-white dark:border-gray-600">
|
||||||
<img src="" id="yourFlag" class="h-4 w-4 me-2" alt="">
|
<img src="" id="yourFlag" class="h-4 w-4 me-2" alt="">
|
||||||
<p id="flagTag"></p>
|
<p id="flagTag"></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="relative w-full">
|
<div class="relative w-full">
|
||||||
<p id="exchange1" 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 border bg-gray-700 border-gray-600 placeholder-gray-400 text-white 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">
|
||||||
@@ -38,6 +38,8 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% } else if(geoData.message == "error") { %>
|
||||||
|
<p>error</p>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<div 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-s-lg focus:ring-4 focus:outline-none focus:ring-gray-100 dark:bg-gray-700 dark:focus:ring-gray-700 dark:text-white dark:border-gray-600">
|
<div 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-s-lg focus:ring-4 focus:outline-none focus:ring-gray-100 dark:bg-gray-700 dark:focus:ring-gray-700 dark:text-white dark:border-gray-600">
|
||||||
@@ -45,7 +47,7 @@
|
|||||||
<p id="flagTag"></p>
|
<p id="flagTag"></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="relative w-full">
|
<div class="relative w-full">
|
||||||
<p 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>
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<!-- Get geolocation if not in session and load conversion rates -->
|
||||||
|
<script src="/static/scripts/geolocation.js"></script>
|
||||||
|
<script>
|
||||||
|
// If no geoData provided thorugh EJS, send update request to backend
|
||||||
|
let country = "<%= geoData.country %>";
|
||||||
|
if (!country) getLocation();
|
||||||
|
</script>
|
||||||
@@ -12,10 +12,10 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="flex justify-between mb-1">
|
<div class="flex justify-between mb-1">
|
||||||
<span class="text-sm font-medium text-blue-700 dark:text-blue-400">Progress</span>
|
<span class="text-sm font-medium text-blue-700 dark:text-blue-400">Progress</span>
|
||||||
<span class="text-sm font-medium text-blue-700 dark:text-blue-400"><%= plan.progress %></span>
|
<span class="text-sm font-medium text-blue-700 dark:text-blue-400"><%= plan.progress %>%</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-full bg-gray-200 rounded-full h-3 dark:bg-gray-700">
|
<div class="w-full bg-gray-200 rounded-full h-3 dark:bg-gray-700">
|
||||||
<div class="bg-blue-600 h-3 rounded-full dark:bg-blue-500" style="width: <%= plan.progress %>;"></div>
|
<div class="bg-blue-600 h-3 rounded-full dark:bg-blue-500" style="width: <%= plan.progress %>%;"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -25,11 +25,11 @@
|
|||||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-4">
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-4">
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-medium text-gray-600 dark:text-gray-400">Number of Assets:</label>
|
<label class="block text-sm font-medium text-gray-600 dark:text-gray-400">Number of Assets:</label>
|
||||||
<p class="mt-1 text-md text-gray-900 dark:text-white">16 MOCK</p>
|
<p class="mt-1 text-md text-gray-900 dark:text-white"><%= assets.length %></p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-medium text-gray-600 dark:text-gray-400">Total Value:</label>
|
<label class="block text-sm font-medium text-gray-600 dark:text-gray-400">Total Value:</label>
|
||||||
<p class="mt-1 text-md text-gray-900 dark:text-white">$165,000 MOCK</p>
|
<p class="mt-1 text-md text-gray-900 dark:text-white"><%= assets.reduce((total, asset) => total + asset.value, 0) %></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
<div class="mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg dark:bg-gray-700 dark:border-gray-600">
|
<div class="mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg dark:bg-gray-700 dark:border-gray-600">
|
||||||
<p class="text-sm text-blue-700 dark:text-blue-300">
|
<p class="text-sm text-blue-700 dark:text-blue-300">
|
||||||
USE YOUR HEAD MOCK
|
<%= suggestions %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -71,4 +71,5 @@
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<%- include("./partials/navBar") %>
|
<%- include("./partials/navBar") %>
|
||||||
|
<%- include("./partials/scriptLoader") %>
|
||||||
<%- include("./partials/footer") %>
|
<%- include("./partials/footer") %>
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
<% 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>
|
||||||
</a>
|
</a>
|
||||||
@@ -21,4 +21,5 @@
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<%- include("./partials/navBar") %>
|
<%- include("./partials/navBar") %>
|
||||||
|
<%- include("./partials/scriptLoader") %>
|
||||||
<%- include("./partials/footer") %>
|
<%- include("./partials/footer") %>
|
||||||
@@ -2,6 +2,46 @@
|
|||||||
<%- include("./partials/header") %>
|
<%- include("./partials/header") %>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
<!-- Confirm delete account modal -->
|
||||||
|
<dialog id="delete-warning-modal" class="w-lg mx-auto bg-transparent p-8 mt-10 rounded-lg shadow-md">
|
||||||
|
<div class="relative p-4 w-full max-w-md h-full md:h-auto">
|
||||||
|
<!-- Modal content -->
|
||||||
|
<div class="relative p-4 text-center bg-white rounded-lg shadow dark:bg-gray-800 sm:p-5">
|
||||||
|
<form method="dialog">
|
||||||
|
<button type="submit" class="text-gray-400 absolute top-2.5 right-2.5 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white">
|
||||||
|
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
|
||||||
|
<span class="sr-only">Close modal</span>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<svg class="text-gray-400 dark:text-gray-500 w-11 h-11 mb-3.5 mx-auto" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z" clip-rule="evenodd"></path></svg>
|
||||||
|
<p class="mb-4 text-gray-500 dark:text-gray-300">Are you sure you want to delete you account? This process cannot be undone.</p>
|
||||||
|
<div class="flex justify-center items-center space-x-4">
|
||||||
|
<div style="width: 100%;">
|
||||||
|
<form method="dialog" style="width: 100%;">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="py-2 px-3 text-sm font-medium text-gray-500 bg-white rounded-lg border border-gray-200 hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-primary-300 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"
|
||||||
|
>
|
||||||
|
No, cancel
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div style="width: 100%;">
|
||||||
|
<form method="POST" action="/deleteUser">
|
||||||
|
<input id="id" name="id" type="text" hidden value="<%= user._id %>">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="py-2 px-3 text-sm font-medium text-center text-white bg-red-600 rounded-lg hover:bg-red-700 focus:ring-4 focus:outline-none focus:ring-red-300 dark:bg-red-500 dark:hover:bg-red-600 dark:focus:ring-red-900"
|
||||||
|
>
|
||||||
|
Yes, I'm sure
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</dialog>
|
||||||
|
|
||||||
<h2 class="ml-11 mt-5 mb-6 text-xl font-semibold mb-4 text-white">Welcome <%= user.name %></h2>
|
<h2 class="ml-11 mt-5 mb-6 text-xl font-semibold mb-4 text-white">Welcome <%= user.name %></h2>
|
||||||
|
|
||||||
<% if (errMessage != "") { %>
|
<% if (errMessage != "") { %>
|
||||||
@@ -16,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">
|
||||||
@@ -32,54 +72,106 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<!--
|
|
||||||
|
<!-- Questionnare details -->
|
||||||
<div class="mb-10 max-w-md mx-auto bg-white p-8 rounded-lg shadow-md">
|
<div class="mb-10 max-w-md mx-auto bg-white p-8 rounded-lg shadow-md">
|
||||||
<div class="flex flex-row justify-between">
|
<div class="flex flex-row justify-between">
|
||||||
<h3 class="pt-2 pr-2 pb-2">Personal information</h3>
|
<h3 class="pt-2 pr-2 pb-2">Personal information</h3>
|
||||||
<button onclick="unlockPersonal()" class="py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">Edit</button>
|
<% if (user.financialData) { %>
|
||||||
|
<button id="edit-personal" onclick="unlockPersonal()" class="py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">Edit</button>
|
||||||
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<% if (user.financialData) { %>
|
||||||
<form action="/updatePersonal" method="post" class="space-y-4" id="personal-form">
|
<form action="/updatePersonal" method="post" class="space-y-4" id="personal-form">
|
||||||
<div>
|
<div>
|
||||||
<label for="dob" class="block text-sm font-medium text-gray-700">Date of Birth</label>
|
<label for="dob" class="block text-sm font-medium text-gray-700">Date of Birth</label>
|
||||||
<input id="dob" disabled type="date" name="dob" 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
|
||||||
|
disabled
|
||||||
|
id="dob"
|
||||||
|
type="date"
|
||||||
|
name="dob"
|
||||||
|
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"
|
||||||
|
<% let year = typeof(user.dob) == "object" ? user.dob.getFullYear() : user.dob.split('-')[0]; %>
|
||||||
|
<% let month = typeof(user.dob) == "object" ? user.dob.getMonth() : user.dob.split('-')[1] - 1; %>
|
||||||
|
<% let day = typeof(user.dob) == "object" ? user.dob.getDate() + 1 : user.dob.split('-')[2].split('T')[0];%>
|
||||||
|
<% let d = new Date(parseInt(year), parseInt(month), parseInt(day)); %>
|
||||||
|
value="<%= d.getFullYear() + "-" + ("0"+(d.getMonth()+1)).slice(-2) + "-" + ("0" + d.getDate()).slice(-2); %>"
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="education" class="block text-sm font-medium text-gray-700">Education</label>
|
<label for="education" class="block text-sm font-medium text-gray-700">Education</label>
|
||||||
<select disabled name="education" id="education" class="mt-1 block w-full px-3 py-2 border border-gray-300 bg-white 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">
|
<select disabled id="education" name="education" id="education" class="mt-1 block w-full px-3 py-2 border border-gray-300 bg-white 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">
|
||||||
<option value="primary">Primary (Elementary)</option>
|
<option <%= user.education == "primary" ? 'selected' : '' %> value="primary">Primary (Elementary)</option>
|
||||||
<option value="secondary">Secondary (High School)</option>
|
<option <%= user.education == "secondary" ? 'selected' : '' %> value="secondary">Secondary (High School)</option>
|
||||||
<option value="tertiary">Tertiary (College/University)</option>
|
<option <%= user.education == "tertiary" ? 'selected' : '' %> value="tertiary">Tertiary (College/University)</option>
|
||||||
<option value="postgraduate">Postgraduate (Master's/PhD)</option>
|
<option <%= user.education == "postgraduate" ? 'selected' : '' %> value="postgraduate">Postgraduate (Master's/PhD)</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-medium text-gray-700">Marital Status</label>
|
<label class="block text-sm font-medium text-gray-700">Marital Status</label>
|
||||||
<div class="mt-1 space-x-4">
|
<div class="mt-1 space-x-4">
|
||||||
<label class="inline-flex items-center">
|
<label class="inline-flex items-center">
|
||||||
<input disabled id="ms-single" type="radio" name="maritalStatus" value="single" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
|
<input disabled <%= user.maritalStatus == "single" ? 'checked' : '' %> id="ms-single" type="radio" name="maritalStatus" value="single" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
|
||||||
<span class="ml-2 text-sm text-gray-700">Single</span>
|
<span class="ml-2 text-sm text-gray-700">Single</span>
|
||||||
</label>
|
</label>
|
||||||
<label class="inline-flex items-center">
|
<label class="inline-flex items-center">
|
||||||
<input disabled id="ms-married" type="radio" name="maritalStatus" value="married" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
|
<input disabled <%= user.maritalStatus == "married" ? 'checked' : '' %> id="ms-married" type="radio" name="maritalStatus" value="married" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
|
||||||
<span class="ml-2 text-sm text-gray-700">Married</span>
|
<span class="ml-2 text-sm text-gray-700">Married</span>
|
||||||
</label>
|
</label>
|
||||||
<label class="inline-flex items-center">
|
<label class="inline-flex items-center">
|
||||||
<input disabled id="ms-divorced" type="radio" name="maritalStatus" value="divorced" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
|
<input disabled <%= user.maritalStatus == "divorced" ? 'checked' : '' %> id="ms-divorced" type="radio" name="maritalStatus" value="divorced" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
|
||||||
<span class="ml-2 text-sm text-gray-700">Divorced</span>
|
<span class="ml-2 text-sm text-gray-700">Divorced</span>
|
||||||
</label>
|
</label>
|
||||||
<label class="inline-flex items-center">
|
<label class="inline-flex items-center">
|
||||||
<input disabled id="ms-widowed" type="radio" name="maritalStatus" value="widowed" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
|
<input disabled <%= user.maritalStatus == "widowed" ? 'checked' : '' %> id="ms-widowed" type="radio" name="maritalStatus" value="widowed" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
|
||||||
<span class="ml-2 text-sm text-gray-700">Widowed</span>
|
<span class="ml-2 text-sm text-gray-700">Widowed</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="income" class="block text-sm font-medium text-gray-700">Annual Gross Income</label>
|
||||||
|
<input disabled value="<%= user.income %>" id="income" type="number" name="income" min="0" placeholder="e.g., 50000" 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">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="expenses" class="block text-sm font-medium text-gray-700">Monthly Expenses</label>
|
||||||
|
<input disabled value="<%= user.expenses %>" id="expenses" type="number" name="expenses" min="0" placeholder="e.g., 2000" 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">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="assets" class="block text-sm font-medium text-gray-700">Net Worth</label>
|
||||||
|
<input disabled value="<%= user.assets %>" id="assets" type="number" name="assets" min="0" placeholder="Estimated Net Worth" 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">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="liabilities" class="block text-sm font-medium text-gray-700">Liabilities</label>
|
||||||
|
<input disabled value="<%= user.liabilities %>" id="liabilities" type="number" name="liabilities" min="0" placeholder="Estimated Liabilities" 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">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button id="save-personal" disabled type="submit" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-not-allowed">Save</button>
|
<button id="save-personal" disabled type="submit" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-not-allowed">Save</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div> -->
|
<% } else { %>
|
||||||
|
<div>
|
||||||
|
<a href="/questionnaire?profile" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer">Answer Questionnare</a>
|
||||||
|
</div>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Delete account -->
|
||||||
|
<div class="flex flex-row justify-center mx-auto p8">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="w-xs p-3 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 cursor-pointer"
|
||||||
|
onclick="document.getElementById('delete-warning-modal').showModal()"
|
||||||
|
>
|
||||||
|
Delete Account
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mt-24"></div>
|
<div class="mt-24"></div>
|
||||||
</main>
|
</main>
|
||||||
@@ -87,4 +179,5 @@
|
|||||||
<script src="/static/scripts/profile.js"></script>
|
<script src="/static/scripts/profile.js"></script>
|
||||||
|
|
||||||
<%- include("./partials/navBar") %>
|
<%- include("./partials/navBar") %>
|
||||||
|
<%- include("./partials/scriptLoader") %>
|
||||||
<%- include("./partials/footer") %>
|
<%- include("./partials/footer") %>
|
||||||
@@ -68,4 +68,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<%- include("./partials/navBar") %>
|
||||||
|
<%- include("./partials/scriptLoader") %>
|
||||||
<%- include("./partials/footer") %>
|
<%- include("./partials/footer") %>
|
||||||
@@ -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") %>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<label for="email" class="block text-base mb-2">Email</label>
|
<label for="email" class="block text-base mb-2">Email</label>
|
||||||
<input type="text" id="email" name="email"
|
<input type="email" id="email" name="email"
|
||||||
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
|
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
|
||||||
placeholder="Enter Email" />
|
placeholder="Enter Email" />
|
||||||
</div>
|
</div>
|
||||||
@@ -29,7 +29,9 @@
|
|||||||
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
|
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
|
||||||
placeholder="Enter Password" />
|
placeholder="Enter Password" />
|
||||||
</div>
|
</div>
|
||||||
<div class="text-red-800 font-bold " id="forgor"> <%= errMessage %></div>
|
<div class="text-red-800 font-bold " id="forgor">
|
||||||
|
<%= errMessage %>
|
||||||
|
</div>
|
||||||
<div class="mt-5">
|
<div class="mt-5">
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
class="border-2 border-gray-600 bg-blue-600 text-white py-1 w-full rounded-md hover:bg-transparent hover:text-indigo-700 font-semibold">Signup</button>
|
class="border-2 border-gray-600 bg-blue-600 text-white py-1 w-full rounded-md hover:bg-transparent hover:text-indigo-700 font-semibold">Signup</button>
|
||||||
@@ -39,8 +41,6 @@
|
|||||||
<a href="/login" class="text-indigo-600 font-semibold">Login</a>
|
<a href="/login" class="text-indigo-600 font-semibold">Login</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<%- include("./partials/footer") %>
|
<%- include("./partials/footer") %>
|
||||||