File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed
Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -93,4 +93,8 @@ export const messages = defineMessages<string>({
9393 id : 'auth.signout' ,
9494 defaultMessage : 'Sign Out' ,
9595 } ,
96+ noProviders : {
97+ id : 'auth.no-providers' ,
98+ defaultMessage : 'No providers available. May be you forgot to enable them?' ,
99+ } ,
96100} ) ;
Original file line number Diff line number Diff line change @@ -253,6 +253,15 @@ describe('<Auth/>', () => {
253253 expect ( input ) . toHaveValue ( expected ) ;
254254 } ) ;
255255
256+ it ( 'should show error when no auth providers are configured' , ( ) => {
257+ StaticStore . config . auth_providers = [ ] ;
258+
259+ const { container } = render ( < Auth /> ) ;
260+
261+ fireEvent . click ( screen . getByText ( 'Sign In' ) ) ;
262+ expect ( container . querySelector ( '.auth-error' ) ) . toBeInTheDocument ( ) ;
263+ } ) ;
264+
256265 describe ( 'OAuth providers' , ( ) => {
257266 it ( 'should not set user if unauthorized' , async ( ) => {
258267 StaticStore . config . auth_providers = [ 'google' ] ;
Original file line number Diff line number Diff line change @@ -201,6 +201,9 @@ export function Auth() {
201201 </ Button >
202202 { isDropdownShown && (
203203 < div className = { clsx ( 'auth-dropdown' , styles . dropdown ) } ref = { ref } >
204+ { ! hasOAuthProviders && ! hasFormProviders && (
205+ < div className = { clsx ( 'auth-error' , styles . error ) } > { intl . formatMessage ( messages . noProviders ) } </ div >
206+ ) }
204207 < form className = { clsx ( 'auth-form' , styles . form ) } onSubmit = { handleSubmit } >
205208 { view === 'telegram' && telegramParamsRef . current !== null ? (
206209 < >
You can’t perform that action at this time.
0 commit comments