fixed auth strategy toggle, updated astro/remix

This commit is contained in:
dswbx
2025-01-17 18:08:23 +01:00
parent baab70f9da
commit 7ddcfc89b4
9 changed files with 42 additions and 28 deletions

View File

@@ -33,7 +33,6 @@ export class AuthController extends Controller {
const name = strategy.getName();
const { create, change } = actions;
const em = this.auth.em;
const mutator = em.mutator(this.auth.config.entity_name as "users");
if (create) {
hono.post(
@@ -46,10 +45,9 @@ export class AuthController extends Controller {
skipMark: true
});
const processed = (await create.preprocess?.(valid)) ?? valid;
console.log("processed", processed);
// @todo: check processed for "role" and check permissions
const mutator = em.mutator(this.auth.config.entity_name as "users");
mutator.__unstable_toggleSystemEntityCreation(false);
const { data: created } = await mutator.insertOne({
...processed,
@@ -98,7 +96,7 @@ export class AuthController extends Controller {
hono.get("/me", auth(), async (c) => {
if (this.auth.authenticator.isUserLoggedIn()) {
return c.json({ user: await this.auth.authenticator.getUser() });
return c.json({ user: this.auth.authenticator.getUser() });
}
return c.json({ user: null }, 403);