feat/Update_Controllers_to_Allow_for_Premium_Membership

This commit is contained in:
cesnimda
2026-08-03 09:17:28 +02:00
parent de937d25dc
commit c3f4a57195
187 changed files with 26062 additions and 991 deletions
+18
View File
@@ -90,6 +90,24 @@ describe('LoginPage', () => {
expect(window.localStorage.getItem('authTokenPersistence')).toBe('session');
});
it('does not complete login when registration requires email verification', async () => {
mockedApi.get.mockClear();
mockedApi.get.mockResolvedValueOnce({
data: { requireAuth: true, googleEnabled: false, microsoftEnabled: false, localEnabled: true, allowRegistration: true, requireEmailVerification: true },
} as any);
mockedApi.post.mockResolvedValueOnce({ data: { verificationRequired: true } } as any);
renderLoginPage('register');
await userEvent.type(await screen.findByLabelText('Email'), 'pending@example.com');
await userEvent.type(screen.getByLabelText('Current password'), 'password1');
await userEvent.type(screen.getByLabelText('Confirm password'), 'password1');
await click(screen.getByRole('button', { name: 'Create account' }));
expect(await screen.findByText('Please verify your email address before signing in.')).toBeInTheDocument();
expect(mockedApi.get).not.toHaveBeenCalledWith('/auth/me');
expect(mockNavigate).not.toHaveBeenCalled();
});
it('rejects an unsafe post-login redirect path', async () => {
mockedApi.post.mockResolvedValueOnce({ data: { authenticated: true, provider: 'local' } } as any);
mockedApi.get.mockResolvedValueOnce({ data: { roles: [], email: 'person@example.com', userName: 'person' } } as any);