|
|
|
|
@ -3,6 +3,7 @@ import { useRouter, useSearchParams } from 'next/navigation'
|
|
|
|
|
import type { FC } from 'react'
|
|
|
|
|
import React, { useCallback, useEffect } from 'react'
|
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
|
import { RiDoorLockLine } from '@remixicon/react'
|
|
|
|
|
import cn from '@/utils/classnames'
|
|
|
|
|
import Toast from '@/app/components/base/toast'
|
|
|
|
|
import { fetchWebOAuth2SSOUrl, fetchWebOIDCSSOUrl, fetchWebSAMLSSOUrl } from '@/service/share'
|
|
|
|
|
@ -98,18 +99,34 @@ const WebSSOForm: FC = () => {
|
|
|
|
|
|
|
|
|
|
init()
|
|
|
|
|
}, [message, processTokenAndRedirect, tokenFromUrl])
|
|
|
|
|
if (systemFeatures.webapp_auth.enable) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex items-center justify-center h-full">
|
|
|
|
|
<div className={cn('flex flex-col items-center w-full grow justify-center', 'px-6', 'md:px-[108px]')}>
|
|
|
|
|
<Button variant='primary' onClick={() => { handleSSOLogin() }}>{t('login.withSSO')}</Button>
|
|
|
|
|
if (systemFeatures.webapp_auth.enabled) {
|
|
|
|
|
if (systemFeatures.webapp_auth.allow_sso) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex items-center justify-center h-full">
|
|
|
|
|
<div className={cn('flex flex-col items-center w-full grow justify-center', 'px-6', 'md:px-[108px]')}>
|
|
|
|
|
<Button variant='primary' onClick={() => { handleSSOLogin() }}>{t('login.withSSO')}</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
return <div className="flex items-center justify-center h-full">
|
|
|
|
|
<div className="p-4 rounded-lg bg-gradient-to-r from-workflow-workflow-progress-bg-1 to-workflow-workflow-progress-bg-2">
|
|
|
|
|
<div className='flex items-center justify-center w-10 h-10 rounded-xl bg-components-card-bg shadow shadows-shadow-lg mb-2'>
|
|
|
|
|
<RiDoorLockLine className='w-5 h-5' />
|
|
|
|
|
</div>
|
|
|
|
|
<p className='system-sm-medium text-text-primary'>{t('login.webapp.noLoginMethod')}</p>
|
|
|
|
|
<p className='system-xs-regular text-text-tertiary mt-1'>{t('login.webapp.noLoginMethodTip')}</p>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
<div className="relative my-2 py-2">
|
|
|
|
|
<div className="absolute inset-0 flex items-center" aria-hidden="true">
|
|
|
|
|
<div className='bg-gradient-to-r from-background-gradient-mask-transparent via-divider-regular to-background-gradient-mask-transparent h-px w-full'></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return <div className="flex items-center justify-center h-full">
|
|
|
|
|
<p>Current App is not required for login, you can <span className='text-text-accent cursor-pointer' onClick={goWebApp}>click here</span> continue.</p>
|
|
|
|
|
<p className='system-xs-regular text-text-tertiary'>{t('login.webapp.disabled')}</p>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|