moved auth ctx to request context, cleaned up system controller

This commit is contained in:
dswbx
2025-02-14 20:32:09 +01:00
parent fb76f8d789
commit 21a8f56c48
10 changed files with 131 additions and 166 deletions

View File

@@ -69,7 +69,7 @@ export class AdminController extends Controller {
hono.use("*", async (c, next) => {
const obj = {
user: auth.authenticator?.getUser(),
user: c.get("auth")?.user,
logout_route: this.withBasePath(authRoutes.logout),
color_scheme: configs.server.admin.color_scheme
};
@@ -91,7 +91,7 @@ export class AdminController extends Controller {
// @ts-ignore
onGranted: async (c) => {
// @todo: add strict test to permissions middleware?
if (auth.authenticator.isUserLoggedIn()) {
if (c.get("auth")?.user) {
console.log("redirecting to success");
return c.redirect(authRoutes.success);
}