fix: strict duplicate login lockout — one device per agent

Block any login attempt when a session exists, regardless of user identity.
Same user on second device is blocked until logout or TTL expiry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-23 21:44:56 +05:30
parent e4a24feedb
commit 77c5335955

View File

@@ -127,9 +127,9 @@ export class AuthController {
throw new HttpException('Agent account not configured. Contact administrator.', 403); throw new HttpException('Agent account not configured. Contact administrator.', 403);
} }
// Check for duplicate login // Check for duplicate login — strict: one device only
const existingSession = await this.sessionService.isSessionLocked(agentConfig.ozonetelAgentId); const existingSession = await this.sessionService.isSessionLocked(agentConfig.ozonetelAgentId);
if (existingSession && existingSession !== memberId) { if (existingSession) {
throw new HttpException('You are already logged in on another device. Please log out there first.', 409); throw new HttpException('You are already logged in on another device. Please log out there first.', 409);
} }