diff --git a/frontend/index.html b/frontend/index.html index 27ca860..a5d57dd 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -6,62 +6,231 @@ LunarFront Manager +
-

LunarFront Manager

-
-

Sign In

+
+
-
-

LunarFront Manager

- -
+
-
-

Provision Customer

- - - -
+ + +
+ + +
+
Create Environment
+
+ + + +
+
+
+ + +
+
Account
+
+ + + + +
+ +
+
+
+
+ +
diff --git a/src/routes/auth.ts b/src/routes/auth.ts index ca3ff37..a6ecbae 100644 --- a/src/routes/auth.ts +++ b/src/routes/auth.ts @@ -67,4 +67,12 @@ export async function authRoutes(app: FastifyInstance) { app.get("/auth/me", { onRequest: [app.authenticate] }, async (req) => { return { username: (req.user as { username: string }).username }; }); + + app.post("/auth/password", { onRequest: [app.authenticate] }, async (req, reply) => { + const { password } = z.object({ password: z.string().min(12) }).parse(req.body); + const { sub } = req.user as { sub: number }; + const hash = await Bun.password.hash(password); + await db`UPDATE users SET password_hash = ${hash} WHERE id = ${sub}`; + return { ok: true }; + }); }