mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 00:11:37 -06:00
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:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user