Skip to content
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.

Commit

Permalink
fix: signup/login bug
Browse files Browse the repository at this point in the history
  • Loading branch information
uhidontkno committed Apr 16, 2024
1 parent 53a2e8c commit 6d1efaf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tempcaptcha.db
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{"5bf773b5-ba42-47a1-922f-001f1bd164ba":"oo.128Oo.8OO.o..1"}

0 comments on commit 6d1efaf

Please sign in to comment.