diff --git a/src/modules/auth/auth.service.ts b/src/modules/auth/auth.service.ts index a07be21..0b2fa04 100644 --- a/src/modules/auth/auth.service.ts +++ b/src/modules/auth/auth.service.ts @@ -63,7 +63,7 @@ export class AuthService { password: passwordHash, }); return { - message: 'Registration successful. Account is pending SuperAdmin verification.', + message: 'Registration successful.', email: user.email, }; } @@ -85,7 +85,7 @@ export class AuthService { }); return { - message: 'Registration successful. Account is pending SuperAdmin verification.', + message: 'Registration successful.', email: user.email, }; } @@ -98,9 +98,6 @@ export class AuthService { if (user.isDisabled) { throw new ForbiddenException('Account is disabled'); } - if (!user.isVerified) { - throw new ForbiddenException('Account is pending SuperAdmin verification'); - } const isMatch = await compareHash(dto.password, user.password); if (!isMatch) { @@ -117,7 +114,7 @@ export class AuthService { ): Promise<{ message: string; debugCode?: string }> { const normalizedEmail = dto.email.toLowerCase(); const user = await this.usersService.findByEmail(normalizedEmail); - const message = 'Account verification is managed by SuperAdmin'; + const message = 'Account verification is optional and can be requested later'; if (!user || user.isDisabled) { return { message }; } @@ -125,12 +122,12 @@ export class AuthService { return { message: 'Account is already verified' }; } - return { message: 'Account is pending SuperAdmin verification' }; + return { message: 'Account is not verified yet. Verification can be requested later.' }; } async verifyEmail(_dto: VerifyEmailDto): Promise<{ message: string }> { return { - message: 'Account verification is managed by SuperAdmin', + message: 'Account verification is optional and can be requested later', }; } @@ -224,10 +221,6 @@ export class AuthService { throw new ForbiddenException('Account is disabled'); } - if (!user.isVerified) { - throw new ForbiddenException('Account is pending SuperAdmin verification'); - } - const tokens = await this.generateAndStoreTokenPair(user.id, user.username, user.role ?? 'user'); const safeUser = await this.usersService.findByIdOrFail(user.id); return { ...tokens, user: safeUser.toObject() as unknown as Record };