add is_deactivated

This commit is contained in:
JakkrapartXD 2026-01-15 10:17:15 +07:00
parent a8976723b2
commit bb80b8a419
3 changed files with 26 additions and 0 deletions

View file

@ -37,6 +37,12 @@ export class AuthService {
throw new UnauthorizedError('Invalid email or password');
}
// Check if account is deactivated
if (user.is_deactivated) {
logger.warn('Login attempt with deactivated account', { email, userId: user.id });
throw new ForbiddenError('This account has been deactivated');
}
// Verify password
const isPasswordValid = await bcrypt.compare(password, user.password);
if (!isPasswordValid) {