Skip to content

Commit 847e366

Browse files
authored
Merge pull request #1410 from credebl/fix/user-not-found-issue
fix:resolved user not found error on login
2 parents c4b4c7b + f93c933 commit 847e366

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

apps/user/src/user.service.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -449,22 +449,20 @@ export class UserService {
449449
try {
450450
this.validateEmail(email.toLowerCase());
451451
const userData = await this.userRepository.checkUserExist(email.toLowerCase());
452-
const userSessionDetails = await this.userRepository.fetchUserSessions(userData?.id);
453-
if (Number(process.env.SESSIONS_LIMIT) <= userSessionDetails?.length) {
454-
throw new BadRequestException(ResponseMessages.user.error.sessionLimitReached);
455-
}
456-
457452
if (!userData) {
458453
throw new NotFoundException(ResponseMessages.user.error.notFound);
459454
}
460-
461455
if (userData && !userData.isEmailVerified) {
462456
throw new BadRequestException(ResponseMessages.user.error.verifyMail);
463457
}
464458

465459
if (true === isPasskey && false === userData?.isFidoVerified) {
466460
throw new UnauthorizedException(ResponseMessages.user.error.registerFido);
467461
}
462+
const userSessionDetails = await this.userRepository.fetchUserSessions(userData?.id);
463+
if (Number(process.env.SESSIONS_LIMIT) <= userSessionDetails?.length) {
464+
throw new BadRequestException(ResponseMessages.user.error.sessionLimitReached);
465+
}
468466
let tokenDetails;
469467
if (true === isPasskey && userData?.username && true === userData?.isFidoVerified) {
470468
const getUserDetails = await this.userRepository.getUserDetails(userData.email.toLowerCase());

0 commit comments

Comments
 (0)