From 6d1efaf3706c5badbf5422d17c7d4e52c1c621b1 Mon Sep 17 00:00:00 2001 From: rare1k Date: Tue, 16 Apr 2024 19:50:39 -0400 Subject: [PATCH] fix: signup/login bug --- server/index.ts | 14 +++++++++++--- tempcaptcha.db | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/server/index.ts b/server/index.ts index f0680f8..dce9d1d 100755 --- a/server/index.ts +++ b/server/index.ts @@ -173,8 +173,15 @@ if (process.argv.includes("--unavailable") || process.argv.includes("-u")) { } // TODO: prevent email sharing try { - pwd = await Bun.password.hash(pwd); + console.log(pwd) + pwd = await Bun.password.hash(pwd,{ + algorithm: "argon2id", // "argon2id" | "argon2i" | "argon2d" + memoryCost: 4096, // memory usage in kibibytes + timeCost: 15, // the number of iterations + }); + console.log(pwd) } catch (e) { + console.error(e) res.statusCode = 500; res.send(e); } @@ -183,7 +190,7 @@ if (process.argv.includes("--unavailable") || process.argv.includes("-u")) { db, "credentials", usr, - `u/${usr}/p/${pwd}/e/${btoa(email)}|guid/${guid}`, + `u/${usr}/p/${pwd.replaceAll("/","??")}/e/${btoa(email)}|guid/${guid}`, ); helper.sql.write( db, @@ -237,7 +244,8 @@ if (process.argv.includes("--unavailable") || process.argv.includes("-u")) { e[0] = e[0].split("/"); let v: any = false; try { - v = await Bun.password.verify(pwd, e[0][3]); + + v = await Bun.password.verify(pwd, e[0][3].replaceAll("??","/")); } catch (e) { res.statusCode = 500; console.error(e); diff --git a/tempcaptcha.db b/tempcaptcha.db index 9e26dfe..e3a5f5b 100755 --- a/tempcaptcha.db +++ b/tempcaptcha.db @@ -1 +1 @@ -{} \ No newline at end of file +{"5bf773b5-ba42-47a1-922f-001f1bd164ba":"oo.128Oo.8OO.o..1"} \ No newline at end of file