fix: ui error when no auth providers configured

This commit is contained in:
Eugene Orlov
2026-06-30 18:23:21 -05:00
committed by Umputun
parent 6840a46ac9
commit 406df022ba
3 changed files with 16 additions and 0 deletions
@@ -65,4 +65,8 @@ export const messages = defineMessages<string>({
id: 'auth.signout',
defaultMessage: 'Sign Out',
},
noProviders: {
id: 'auth.no-providers',
defaultMessage: 'No providers available. May be you forgot to enable them?',
},
});
@@ -254,6 +254,15 @@ describe('<Auth/>', () => {
expect(input).toHaveValue(expected);
});
it('should show error when no auth providers are configured', () => {
StaticStore.config.auth_providers = [];
const { container } = render(<Auth />);
fireEvent.click(screen.getByText('Sign In'));
expect(container.querySelector('.auth-error')).toBeInTheDocument();
});
describe('OAuth providers', () => {
it('should not set user if unauthorized', async () => {
StaticStore.config.auth_providers = ['google'];
@@ -201,6 +201,9 @@ export function Auth() {
</Button>
{isDropdownShown && (
<div className={clsx('auth-dropdown', styles.dropdown)} ref={ref}>
{!hasOAuthProviders && !hasFormProviders && (
<div className={clsx('auth-error', styles.error)}>{intl.formatMessage(messages.noProviders)}</div>
)}
<form className={clsx('auth-form', styles.form)} onSubmit={handleSubmit}>
{view === 'telegram' && telegramParamsRef.current !== null ? (
<>