mirror of
				https://github.com/steveiliop56/tinyauth.git
				synced 2025-10-31 06:05:43 +00:00 
			
		
		
		
	fix: check available providers correctly
This commit is contained in:
		| @@ -26,6 +26,9 @@ export const LoginPage = () => { | |||||||
|   const redirectUri = params.get("redirect_uri"); |   const redirectUri = params.get("redirect_uri"); | ||||||
|  |  | ||||||
|   const { isLoggedIn, configuredProviders } = useUserContext(); |   const { isLoggedIn, configuredProviders } = useUserContext(); | ||||||
|  |   const oauthProviders = configuredProviders.filter( | ||||||
|  |     (value) => value !== "username", | ||||||
|  |   ); | ||||||
|  |  | ||||||
|   if (isLoggedIn) { |   if (isLoggedIn) { | ||||||
|     return <Navigate to="/logout" />; |     return <Navigate to="/logout" />; | ||||||
| @@ -107,18 +110,13 @@ export const LoginPage = () => { | |||||||
|     <Layout> |     <Layout> | ||||||
|       <Title ta="center">Tinyauth</Title> |       <Title ta="center">Tinyauth</Title> | ||||||
|       <Paper shadow="md" p="xl" mt={30} radius="md" withBorder> |       <Paper shadow="md" p="xl" mt={30} radius="md" withBorder> | ||||||
|         {configuredProviders.length === 0 && ( |         {oauthProviders.length > 0 && ( | ||||||
|           <Text size="lg" mb="md" fw={500} ta="center"> |  | ||||||
|             Welcome back, please login |  | ||||||
|           </Text> |  | ||||||
|         )} |  | ||||||
|         {configuredProviders.length > 0 && ( |  | ||||||
|           <> |           <> | ||||||
|             <Text size="lg" fw={500} ta="center"> |             <Text size="lg" fw={500} ta="center"> | ||||||
|               Welcome back, login with |               Welcome back, login with | ||||||
|             </Text> |             </Text> | ||||||
|             <Grid mb="md" mt="md" align="center" justify="center"> |             <Grid mb="md" mt="md" align="center" justify="center"> | ||||||
|               {configuredProviders.includes("google") && ( |               {oauthProviders.includes("google") && ( | ||||||
|                 <Grid.Col span="content"> |                 <Grid.Col span="content"> | ||||||
|                   <Button |                   <Button | ||||||
|                     radius="xl" |                     radius="xl" | ||||||
| @@ -133,7 +131,7 @@ export const LoginPage = () => { | |||||||
|                   </Button> |                   </Button> | ||||||
|                 </Grid.Col> |                 </Grid.Col> | ||||||
|               )} |               )} | ||||||
|               {configuredProviders.includes("github") && ( |               {oauthProviders.includes("github") && ( | ||||||
|                 <Grid.Col span="content"> |                 <Grid.Col span="content"> | ||||||
|                   <Button |                   <Button | ||||||
|                     radius="xl" |                     radius="xl" | ||||||
| @@ -148,7 +146,7 @@ export const LoginPage = () => { | |||||||
|                   </Button> |                   </Button> | ||||||
|                 </Grid.Col> |                 </Grid.Col> | ||||||
|               )} |               )} | ||||||
|               {configuredProviders.includes("generic") && ( |               {oauthProviders.includes("generic") && ( | ||||||
|                 <Grid.Col span="content"> |                 <Grid.Col span="content"> | ||||||
|                   <Button |                   <Button | ||||||
|                     radius="xl" |                     radius="xl" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stavros
					Stavros