Events 2.3.0 (phase 1c): two-factor with an authenticator app, recovery codes
- TOTP (RFC 6238) next to email and WhatsApp: QR code and key to set up, the app's first code confirms it, a code can't be used twice, nothing is sent. The secret is stored encrypted. - 10 single-use recovery codes whenever two-factor is turned on, shown once; accepted at sign-in in place of any code; a new set on request. - Admins see each account's method; Reset 2FA clears the app and codes. - Profile & Security, sign-in and Users pages; API types; 10 new tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -117,15 +117,15 @@ afterEach(() => jest.restoreAllMocks());
|
||||
|
||||
describe('availableMethods', () => {
|
||||
test('offers WhatsApp only with a valid phone and a configured gateway', async () => {
|
||||
expect(await availableMethods(USER)).toEqual(['email', 'whatsapp']);
|
||||
expect(await availableMethods(USER)).toEqual(['email', 'whatsapp', 'authenticator']);
|
||||
mockWhatsApp.configured = false;
|
||||
expect(await availableMethods(USER)).toEqual(['email']);
|
||||
expect(await availableMethods(USER)).toEqual(['email', 'authenticator']);
|
||||
mockWhatsApp.configured = true;
|
||||
expect(await availableMethods({ ...USER, phoneNumber: null })).toEqual(['email']);
|
||||
expect(await availableMethods({ ...USER, phoneNumber: null })).toEqual(['email', 'authenticator']);
|
||||
});
|
||||
|
||||
test('offers nothing by email for a guest placeholder address', async () => {
|
||||
expect(await availableMethods({ ...USER, email: 'x@guest.local' })).toEqual(['whatsapp']);
|
||||
expect(await availableMethods({ ...USER, email: 'x@guest.local' })).toEqual(['whatsapp', 'authenticator']);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user