mirror of
https://github.com/Expand-sys/ccashfrontend
synced 2025-12-18 07:32:14 +11:00
twixes special patch
This commit is contained in:
parent
00bc517cb4
commit
a171fa2368
1 changed files with 75 additions and 91 deletions
28
index.js
28
index.js
|
|
@ -123,18 +123,6 @@ fastify.get(
|
|||
let balance = 0;
|
||||
const user = req.session.get("user");
|
||||
const password = req.session.get("password");
|
||||
if (admin == 1) {
|
||||
console.log("punching sand");
|
||||
balance = await client.balance(req.session.get("user"));
|
||||
res.view("bankf", {
|
||||
user: req.session.get("user"),
|
||||
balance: balance,
|
||||
admin: req.session.get("admin"),
|
||||
sucesses: successes,
|
||||
errors: errors,
|
||||
alive: true,
|
||||
});
|
||||
} else {
|
||||
balance = await client.balance(req.session.get("user"));
|
||||
console.log(balance);
|
||||
console.log("start " + Date.now());
|
||||
|
|
@ -152,12 +140,10 @@ fastify.get(
|
|||
for (i = graphlog.length - 1; i > -1; i--) {
|
||||
if (graphlog[i].from == req.session.get("user")) {
|
||||
currentbal = parseInt(currentbal) + parseInt(graphlog[i].amount);
|
||||
graphdata =
|
||||
graphdata + ", [" + parseInt(i) + "," + currentbal + "]";
|
||||
graphdata = graphdata + ", [" + parseInt(i) + "," + currentbal + "]";
|
||||
} else {
|
||||
currentbal = parseInt(currentbal) - parseInt(graphlog[i].amount);
|
||||
graphdata =
|
||||
graphdata + ", [" + parseInt(i) + "," + currentbal + "]";
|
||||
graphdata = graphdata + ", [" + parseInt(i) + "," + currentbal + "]";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -178,9 +164,7 @@ fastify.get(
|
|||
if (logrec == null) {
|
||||
logrec = undefined;
|
||||
} else {
|
||||
logrec = await logrec.filter(
|
||||
({ to }) => to === req.session.get("user")
|
||||
);
|
||||
logrec = await logrec.filter(({ to }) => to === req.session.get("user"));
|
||||
}
|
||||
if (logsent) {
|
||||
for (i in logrec) {
|
||||
|
|
@ -215,7 +199,6 @@ fastify.get(
|
|||
alive: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
fastify.post(
|
||||
|
|
@ -284,8 +267,11 @@ fastify.post("/login", async function (req, res) {
|
|||
}
|
||||
const { name, password } = req.body;
|
||||
let adminTest;
|
||||
let verified;
|
||||
|
||||
try {
|
||||
adminTest = await client.adminVerifyPassword(password);
|
||||
verified = await client.verifyPassword(name, password);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
|
@ -297,8 +283,6 @@ fastify.post("/login", async function (req, res) {
|
|||
req.session.set("password", password);
|
||||
res.redirect("/BankF");
|
||||
} else {
|
||||
let verified;
|
||||
verified = await client.verifyPassword(name, password);
|
||||
console.log(verified);
|
||||
if (verified == 1) {
|
||||
req.session.set("user", name);
|
||||
|
|
|
|||
Loading…
Reference in a new issue