fix and update

This commit is contained in:
lendry
2026-07-07 08:06:55 +03:00
parent 28b04ada81
commit 9ca5071f1a
8 changed files with 152 additions and 20 deletions

View File

@@ -17,7 +17,7 @@ export class FedcmService {
) {}
async getAccounts(userId: string, sessionId: string) {
await this.assertUnlockedSession(userId, sessionId);
await this.assertExistingSession(userId, sessionId);
const user = await this.prisma.user.findFirst({
where: { id: userId, deletedAt: null, status: 'ACTIVE', ...HUMAN_USER_WHERE }
@@ -104,12 +104,17 @@ export class FedcmService {
return this.settings.getBoolean('ONE_TAP_ENABLED', true);
}
private async assertUnlockedSession(userId: string, sessionId: string) {
private async assertExistingSession(userId: string, sessionId: string) {
const state = await this.session.resolveSessionState(sessionId);
if (!state || state.userId !== userId) {
throw new UnauthorizedException('Сессия недействительна или истекла');
}
if (state.requiresPin) {
}
private async assertUnlockedSession(userId: string, sessionId: string) {
await this.assertExistingSession(userId, sessionId);
const state = await this.session.resolveSessionState(sessionId);
if (state?.requiresPin) {
throw new UnauthorizedException('Требуется подтверждение PIN-кода');
}
}