prevent login and password reset for system accounts

This commit is contained in:
Hazel K 2024-10-07 14:58:39 -04:00
parent 126a2fcf15
commit cd9bce3072
8 changed files with 45 additions and 1 deletions

View file

@ -26,6 +26,7 @@ import { RateLimiterService } from './RateLimiterService.js';
import { SigninService } from './SigninService.js';
import type { AuthenticationResponseJSON } from '@simplewebauthn/types';
import type { FastifyReply, FastifyRequest } from 'fastify';
import { isSystemAccount } from '@/misc/is-system-account.js';
@Injectable()
export class SigninApiService {
@ -125,6 +126,12 @@ export class SigninApiService {
});
}
if (isSystemAccount(user)) {
return error(403, {
id: 's8dhsj9s-a93j-493j-ja9k-kas9sj20aml2',
});
}
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: user.id });
if (!user.approved && instance.approvalRequiredForSignup) {