[backend/web-api] Make auth status response less confusing

This commit is contained in:
Laura Hausmann 2023-12-11 22:42:17 +01:00
parent 1870dc33b5
commit 8134e92284
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
2 changed files with 2 additions and 4 deletions

View file

@ -21,8 +21,7 @@ export class AuthController {
): Promise<AuthResponse> {
const user = me ? await UserHandler.getUser(me, me.id) : null;
return {
authenticated: !!session?.active,
status: user && session?.active ? null : '2fa',
status: !user ? 'guest' : session?.active ? 'authenticated' : '2fa',
token: session?.token ?? null,
user: user,
};

View file

@ -1,8 +1,7 @@
import { UserResponse } from "@/server/api/web/entities/user.js";
export type AuthResponse = {
authenticated: boolean;
status: null | '2fa';
status: 'guest' | 'authenticated' | '2fa';
token: string | null;
user: UserResponse | null;
}