mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
fix: should retrieve user inactive error in login response API.
fix: prevent from delete or inactivate the current authorized user.
This commit is contained in:
@@ -59,20 +59,20 @@ export default class AuthenticationService {
|
||||
this.logger.info('[login] invalid data');
|
||||
throw new ServiceError('invalid_details');
|
||||
}
|
||||
this.logger.info('[login] check password validation.');
|
||||
this.logger.info('[login] check password validation.', { emailOrPhone, password });
|
||||
if (!user.verifyPassword(password)) {
|
||||
throw new ServiceError('invalid_password');
|
||||
}
|
||||
|
||||
if (!user.active) {
|
||||
this.logger.info('[login] user inactive.');
|
||||
this.logger.info('[login] user inactive.', { userId: user.id });
|
||||
throw new ServiceError('user_inactive');
|
||||
}
|
||||
|
||||
this.logger.info('[login] generating JWT token.');
|
||||
this.logger.info('[login] generating JWT token.', { userId: user.id });
|
||||
const token = this.generateToken(user);
|
||||
|
||||
this.logger.info('[login] updating user last login at.');
|
||||
this.logger.info('[login] updating user last login at.', { userId: user.id });
|
||||
await systemUserRepository.patchLastLoginAt(user.id);
|
||||
|
||||
this.logger.info('[login] Logging success.', { user, token });
|
||||
|
||||
Reference in New Issue
Block a user