2
0

add azure-ad login option

This commit is contained in:
Bün Colak
2022-06-06 15:34:47 +02:00
committed by Baptiste Arnaud
parent e79ff09b0f
commit ee370b5f26
4 changed files with 65 additions and 1 deletions

View File

@ -9,7 +9,7 @@ import {
import { useRouter } from 'next/router'
import React from 'react'
import { stringify } from 'qs'
import { FacebookLogo, GoogleLogo, GitlabLogo } from 'assets/logos'
import { FacebookLogo, GoogleLogo, GitlabLogo, AzureAdLogo } from 'assets/logos'
import { BuiltInProviderType } from 'next-auth/providers'
type Props = {
@ -42,6 +42,11 @@ export const SocialLoginButtons = ({ providers }: Props) => {
callbackUrl: `/typebots?${stringify(query)}`,
})
const handleAzureAdClick = async () =>
signIn('azure-ad', {
callbackUrl: `/typebots?${stringify(query)}`,
})
return (
<Stack>
{providers?.github && (
@ -88,6 +93,17 @@ export const SocialLoginButtons = ({ providers }: Props) => {
Continue with {providers.gitlab.name}
</Button>
)}
{providers?.['azure-ad'] && (
<Button
leftIcon={<AzureAdLogo />}
onClick={handleAzureAdClick}
data-testid='azure-ad'
isLoading={['loading', 'authenticated'].includes(status)}
variant="outline"
>
Continue with {providers['azure-ad'].name}
</Button>
)}
</Stack>
)
}