aboutsummaryrefslogtreecommitdiffstats
path: root/lib/register.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/register.js')
-rw-r--r--lib/register.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/register.js b/lib/register.js
index 27651abd..49111d96 100644
--- a/lib/register.js
+++ b/lib/register.js
@@ -1,4 +1,3 @@
-import bcrypt from "bcrypt";
import { got } from "got";
import { authenticator } from "otplib";
import { v4 } from "uuid";
@@ -16,7 +15,8 @@ export default async (user, ip, requireChallenge) => {
if (!username) fail("Username required");
username = username.toLowerCase();
- if (!valid.test(username)) fail("Usernames can only have letters and numbers");
+ if (!valid.test(username))
+ fail("Usernames can only have letters and numbers");
let id = v4();
user.id = id;
@@ -25,7 +25,10 @@ export default async (user, ip, requireChallenge) => {
if (exists) fail(`Username ${username} taken`);
if (password) {
- user.password = await bcrypt.hash(password, 1);
+ user.password = await Bun.password.hash(password, {
+ algorithm: "bcrypt",
+ cost: 1,
+ });
}
user.currency = "USD";