mirror of
https://github.com/documenso/documenso.git
synced 2026-07-25 09:25:08 +10:00
chore: disabled account enforcement (#2882)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { assertUserNotDisabledById } from '@documenso/lib/server-only/user/assert-user-not-disabled';
|
||||
import type { Context } from 'hono';
|
||||
|
||||
import type { HonoAuthContext } from '../../types/context';
|
||||
@@ -10,8 +11,15 @@ type AuthorizeUser = {
|
||||
|
||||
/**
|
||||
* Handles creating a session.
|
||||
*
|
||||
* Refuses to issue a session for a disabled account. This is the single
|
||||
* chokepoint shared by every sign-in path (email/password, passkey, OAuth,
|
||||
* OIDC, organisation OIDC), so the guard belongs here rather than in each
|
||||
* caller.
|
||||
*/
|
||||
export const onAuthorize = async (user: AuthorizeUser, c: Context<HonoAuthContext>) => {
|
||||
await assertUserNotDisabledById({ userId: user.userId });
|
||||
|
||||
const metadata = c.get('requestMetadata');
|
||||
|
||||
const sessionToken = generateSessionToken();
|
||||
|
||||
Reference in New Issue
Block a user