Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3b06226ee |
No files matched your search
@@ -73,7 +73,7 @@ module.exports = (users) => {
|
|||||||
router.post("/signup", async (req, res) => {
|
router.post("/signup", async (req, res) => {
|
||||||
const userSchema = joi.object({
|
const userSchema = joi.object({
|
||||||
email: joi.string().email({ minDomainSegments: 2, tlds: { allow: true } }).required(),
|
email: joi.string().email({ minDomainSegments: 2, tlds: { allow: true } }).required(),
|
||||||
name: joi.string().pattern(new RegExp('^[a-zA-Z0-9_ ]*$')).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().max(20).min(8).required(),
|
||||||
repassword: joi.string().max(20).min(8).required(),
|
repassword: joi.string().max(20).min(8).required(),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ module.exports = (users) => {
|
|||||||
$set: { resetToken: token, resetTokenExpires: expiration }
|
$set: { resetToken: token, resetTokenExpires: expiration }
|
||||||
});
|
});
|
||||||
|
|
||||||
const resetUrl = `http://localhost:${PORT}/reset/${token}`;
|
const resetUrl = `https://rcalculator.sowinski.dev/${PORT}/reset/${token}`;
|
||||||
|
|
||||||
const mailSend = {
|
const mailSend = {
|
||||||
from: process.env.EMAIL_USER,
|
from: process.env.EMAIL_USER,
|
||||||
|
|||||||
+1
-1
@@ -477,7 +477,7 @@ module.exports = (middleware, users, plans, assets) => {
|
|||||||
router.post("/updateAccount", async (req, res) => {
|
router.post("/updateAccount", async (req, res) => {
|
||||||
const accountSchema = joi.object({
|
const accountSchema = joi.object({
|
||||||
email: joi.string().email({ minDomainSegments: 2, tlds: { allow: true } }),
|
email: joi.string().email({ minDomainSegments: 2, tlds: { allow: true } }),
|
||||||
name: joi.string().pattern(new RegExp('^[a-zA-Z0-9_ ]*$')).max(20),
|
name: joi.string().pattern(new RegExp('^[a-zA-Z]+$')).max(20),
|
||||||
password: joi.string().max(20).min(8),
|
password: joi.string().max(20).min(8),
|
||||||
repassword: joi.string().max(20).min(8),
|
repassword: joi.string().max(20).min(8),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -56,15 +56,9 @@ async function calculateTotalAssetValue(assets) {
|
|||||||
if (asset.value < 1000) {
|
if (asset.value < 1000) {
|
||||||
totalAssetValue += asset.value;
|
totalAssetValue += asset.value;
|
||||||
} else {
|
} else {
|
||||||
const assetYear = asset.year;
|
const assetYear = new Date(asset.year).getFullYear();
|
||||||
const age = today.getFullYear() - assetYear;
|
const age = today.getFullYear() - assetYear;
|
||||||
let depreciatedValue;
|
let depreciatedValue = asset.value * Math.pow(0.85, age);
|
||||||
|
|
||||||
if (age < 1){
|
|
||||||
depreciatedValue = asset.value * 0.9;
|
|
||||||
}else{
|
|
||||||
depreciatedValue = asset.value * Math.pow(0.90, age);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (depreciatedValue < 1000) {
|
if (depreciatedValue < 1000) {
|
||||||
totalAssetValue += 1000;
|
totalAssetValue += 1000;
|
||||||
|
|||||||
+12
-10
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<main class="pt-24 pb-14">
|
<main class="pt-24 pb-14">
|
||||||
<!-- Buttons -->
|
<!-- Buttons -->
|
||||||
<div class="flex justify-end gap-4 px-5 py-6">
|
<div class="flex md:justify-end justify-center gap-4 px-5 py-6 md:py-0">
|
||||||
<a href="/assets?popup"
|
<a href="/assets?popup"
|
||||||
id="addAss" class="text-center cursor-pointer min-w-[150px] bg-green-600 px-4 py-2 text-white rounded hover:bg-green-800"
|
id="addAss" 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>
|
type="button">Add Asset</a>
|
||||||
@@ -14,15 +14,17 @@
|
|||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<div class="mb-12 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-y-4 gap-x-6">
|
<div class="mb-12 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-y-4 gap-x-6">
|
||||||
<% if (plans.length === 0) { %>
|
<% if (plans.length === 0) { %>
|
||||||
<div class="col-span-1 col-start-2 ml-28 mt-25">
|
<div class="flex justify-center md:col-start-2">
|
||||||
<div class="w-86 p-4 bg-white rounded-lg shadow-xl border border-slate-200">
|
<div class="col-span-1 mt-25">
|
||||||
<h1 class="text-2xl block text-center font-semibold text-slate-700">Don't have any retirement plans? </h1>
|
<div class="w-86 p-4 bg-white rounded-lg shadow-xl border border-slate-200">
|
||||||
<div class="mt-4 flex justify-center items-center">
|
<h1 class="text-2xl block text-center font-semibold text-slate-700">Don't have any retirement plans? </h1>
|
||||||
<div class="mt-4 flex justify-center">
|
<div class="mt-4 flex justify-center items-center">
|
||||||
<a href="/plans" class="cursor-pointer border-2 border-blue-600 bg-blue-600 text-white py-2 px-6
|
<div class="mt-4 flex justify-center">
|
||||||
rounded-md hover:bg-blue-700 hover:border-blue-700 font-semibold
|
<a href="/plans" class="cursor-pointer border-2 border-blue-600 bg-blue-600 text-white py-2 px-6
|
||||||
transition-colors duration-200 focus:outline-none ">Make one</a>
|
rounded-md hover:bg-blue-700 hover:border-blue-700 font-semibold
|
||||||
</div>
|
transition-colors duration-200 focus:outline-none ">Make one</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user