aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-09-03 23:24:59 -0700
committerAdam Soltys <[email protected]>2024-09-03 23:24:59 -0700
commitdfde1c88ebb52e50f983f5a36e8868dd0938c3fc (patch)
treefd55db5c6761be6d7b1641af776b34e4c87170de
parent53b4db29cda68a83e9911f163454e158cbbb817f (diff)
downloadcoinos-server-dfde1c88ebb52e50f983f5a36e8868dd0938c3fc.tar.gz
coinos-server-dfde1c88ebb52e50f983f5a36e8868dd0938c3fc.zip
increase bcrypt rounds
-rw-r--r--lib/register.ts11
-rw-r--r--routes/users.ts18
2 files changed, 10 insertions, 19 deletions
diff --git a/lib/register.ts b/lib/register.ts
index 49111d96..eb20ae23 100644
--- a/lib/register.ts
+++ b/lib/register.ts
@@ -4,13 +4,13 @@ import { v4 } from "uuid";
import config from "$config";
import countries from "$lib/countries";
-import { s, g, archive } from "$lib/db";
+import { s } from "$lib/db";
import { l, warn } from "$lib/logging";
import { fail, getUser } from "$lib/utils";
let valid = /^[\p{L}\p{N}]{2,24}$/u;
-export default async (user, ip, requireChallenge) => {
- let { profile, password, pubkey, username } = user;
+export default async (user, ip) => {
+ let { password, pubkey, username } = user;
l("registering", username);
if (!username) fail("Username required");
@@ -27,7 +27,7 @@ export default async (user, ip, requireChallenge) => {
if (password) {
user.password = await Bun.password.hash(password, {
algorithm: "bcrypt",
- cost: 1,
+ cost: 4,
});
}
@@ -36,7 +36,7 @@ export default async (user, ip, requireChallenge) => {
try {
let {
location: { country: { code } },
- } = await got(
+ }: any = await got(
`https://api.ipregistry.co/${ip}?key=${config.ipregistry}&fields=location.country.code`,
).json();
@@ -58,5 +58,6 @@ export default async (user, ip, requireChallenge) => {
await s(`balance:${id}`, 0);
l("new user", username);
+
return user;
};
diff --git a/routes/users.ts b/routes/users.ts
index 4fe04bda..e6044a47 100644
--- a/routes/users.ts
+++ b/routes/users.ts
@@ -16,6 +16,7 @@ import upload from "$lib/upload";
const { encode, decode, fromWords, toWords } = bech32;
+console.log("HI");
export default {
upload,
@@ -189,18 +190,7 @@ export default {
try {
l("updating user", user.username);
- let {
- profile,
- banner,
- confirm,
- password,
- pin,
- newpin,
- pubkey,
- username,
- shopifyToken,
- shopifyStore,
- } = body;
+ let { confirm, password, pin, newpin, pubkey, username } = body;
if (user.pin && !(pin === user.pin)) fail("Pin required");
if (typeof newpin !== "undefined" && newpin.length === 6)
@@ -267,7 +257,7 @@ export default {
if (password && password === confirm) {
user.password = await Bun.password.hash(password, {
algorithm: "bcrypt",
- cost: 1,
+ cost: 4,
});
}
@@ -461,7 +451,7 @@ export default {
user.salt = null;
user.password = await Bun.password.hash(password, {
algorithm: "bcrypt",
- cost: 1,
+ cost: 4,
});
await s(`user:${id}`, user);