Fix biometric auth TypeScript errors
- Add LOGIN_BIOMETRIC to AuditAction enum - Import AuditAction and EntityType in AuthService - Fix loginWithExternalAuth return type to match AuthResponse interface - Update biometric API client to use correct response structure - Update login page to access tokens from nested data structure 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,7 @@ export enum AuditAction {
|
||||
DELETE = 'DELETE',
|
||||
EXPORT = 'EXPORT',
|
||||
LOGIN = 'LOGIN',
|
||||
LOGIN_BIOMETRIC = 'LOGIN_BIOMETRIC',
|
||||
LOGOUT = 'LOGOUT',
|
||||
PASSWORD_RESET = 'PASSWORD_RESET',
|
||||
EMAIL_VERIFY = 'EMAIL_VERIFY',
|
||||
|
||||
@@ -11,7 +11,7 @@ import { JwtService } from '@nestjs/jwt';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import * as bcrypt from 'bcrypt';
|
||||
import * as crypto from 'crypto';
|
||||
import { User, DeviceRegistry, RefreshToken, Family, FamilyMember } from '../../database/entities';
|
||||
import { User, DeviceRegistry, RefreshToken, Family, FamilyMember, AuditAction, EntityType } from '../../database/entities';
|
||||
import { RegisterDto } from './dto/register.dto';
|
||||
import { LoginDto } from './dto/login.dto';
|
||||
import { RefreshTokenDto } from './dto/refresh-token.dto';
|
||||
@@ -433,30 +433,35 @@ export class AuthService {
|
||||
// Audit log for biometric login
|
||||
await this.auditService.log({
|
||||
userId: user.id,
|
||||
action: 'LOGIN_BIOMETRIC',
|
||||
resourceType: 'AUTH',
|
||||
resourceId: user.id,
|
||||
metadata: {
|
||||
deviceId: device.deviceFingerprint,
|
||||
platform: device.platform,
|
||||
action: AuditAction.LOGIN_BIOMETRIC,
|
||||
entityType: EntityType.USER,
|
||||
entityId: user.id,
|
||||
changes: {
|
||||
after: {
|
||||
deviceId: device.deviceFingerprint,
|
||||
platform: device.platform,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
accessToken: tokens.accessToken,
|
||||
refreshToken: tokens.refreshToken,
|
||||
expiresIn: tokens.expiresIn,
|
||||
user: {
|
||||
id: user.id,
|
||||
email: user.email,
|
||||
name: user.name,
|
||||
phone: user.phone,
|
||||
locale: user.locale,
|
||||
timezone: user.timezone,
|
||||
emailVerified: user.emailVerified,
|
||||
createdAt: user.createdAt,
|
||||
familyMemberships: user.familyMemberships,
|
||||
preferences: user.preferences,
|
||||
success: true,
|
||||
data: {
|
||||
tokens: {
|
||||
accessToken: tokens.accessToken,
|
||||
refreshToken: tokens.refreshToken,
|
||||
expiresIn: tokens.expiresIn,
|
||||
},
|
||||
user: {
|
||||
id: user.id,
|
||||
email: user.email,
|
||||
name: user.name,
|
||||
locale: user.locale,
|
||||
emailVerified: user.emailVerified,
|
||||
preferences: user.preferences,
|
||||
},
|
||||
deviceRegistered: true,
|
||||
deviceTrusted: device.trusted,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user