feat(auth): allow 25 active magic links per user

Raise the shared-account link ceiling so admins can provision more concurrent demo or shared login URLs without revoking existing active links.
This commit is contained in:
neon
2026-05-19 13:15:21 -06:00
parent e0686181d6
commit bb11fc2abc
2 changed files with 5 additions and 3 deletions
@@ -51,9 +51,11 @@ describe('MagicLinkService', () => {
it('throws BadRequestException when max tokens reached', async () => {
const { service, magicLinkRepo } = makeService();
magicLinkRepo.countActiveByUserId.mockResolvedValue(5);
magicLinkRepo.countActiveByUserId.mockResolvedValue(25);
await expect(service.createToken(makeActor(), { userId: 2, label: 'Test' } as never)).rejects.toThrow(BadRequestException);
await expect(service.createToken(makeActor(), { userId: 2, label: 'Test' } as never)).rejects.toThrow(
'Maximum of 25 active magic links per user',
);
});
it('throws BadRequestException when expiry is in the past', async () => {
@@ -11,7 +11,7 @@ import { AuthService } from './auth.service';
import { CreateMagicLinkDto } from './dto/create-magic-link.dto';
import { MagicLinkRepository } from './magic-link.repository';
const MAX_TOKENS_PER_USER = 5;
const MAX_TOKENS_PER_USER = 25;
function sha256(value: string): string {
return createHash('sha256').update(value).digest('hex');