-
+
-
-
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 };
+ });
}