feat: redesign UI with sidebar, centered login, account page with password reset
Some checks failed
Build & Release / build (push) Failing after 5s
Some checks failed
Build & Release / build (push) Failing after 5s
This commit is contained in:
@@ -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 };
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user