fix: add 'back to home' link when webapp sign in failed

pull/20109/head
NFish 12 months ago
parent ce635d7e24
commit 8a38cd59e2

@ -11,6 +11,7 @@ import AppUnavailable from '@/app/components/base/app-unavailable'
import NormalForm from './normalForm' import NormalForm from './normalForm'
import { AccessMode } from '@/models/access-control' import { AccessMode } from '@/models/access-control'
import ExternalMemberSsoAuth from './components/external-member-sso-auth' import ExternalMemberSsoAuth from './components/external-member-sso-auth'
import Link from 'next/link'
const WebSSOForm: FC = () => { const WebSSOForm: FC = () => {
const { t } = useTranslation() const { t } = useTranslation()
@ -23,10 +24,16 @@ const WebSSOForm: FC = () => {
const tokenFromUrl = searchParams.get('web_sso_token') const tokenFromUrl = searchParams.get('web_sso_token')
const message = searchParams.get('message') const message = searchParams.get('message')
const showErrorToast = (message: string) => { const getSigninUrl = useCallback(() => {
const params = new URLSearchParams(searchParams)
params.delete('message')
return `/webapp-signin?${params.toString()}`
}, [searchParams])
const showErrorToast = (msg: string) => {
Toast.notify({ Toast.notify({
type: 'error', type: 'error',
message, message: msg,
}) })
} }
@ -63,6 +70,7 @@ const WebSSOForm: FC = () => {
if (message) { if (message) {
return <div className='flex h-full items-center justify-center'> return <div className='flex h-full items-center justify-center'>
<AppUnavailable code={'App Unavailable'} unknownReason={message} /> <AppUnavailable code={'App Unavailable'} unknownReason={message} />
<Link href={getSigninUrl()}>{t('share.login.backToHome')}</Link>
</div> </div>
} }
if (!redirectUrl) { if (!redirectUrl) {
@ -92,6 +100,7 @@ const WebSSOForm: FC = () => {
return <div className='flex h-full items-center justify-center'> return <div className='flex h-full items-center justify-center'>
<AppUnavailable code={'App Unavailable'} isUnknownReason={true} /> <AppUnavailable code={'App Unavailable'} isUnknownReason={true} />
<Link href={getSigninUrl()}>{t('share.login.backToHome')}</Link>
</div> </div>
} }

@ -77,6 +77,9 @@ const translation = {
atLeastOne: 'Please input at least one row in the uploaded file.', atLeastOne: 'Please input at least one row in the uploaded file.',
}, },
}, },
login: {
backToHome: 'Back to Home',
},
} }
export default translation export default translation

@ -73,6 +73,9 @@ const translation = {
atLeastOne: '1行以上のデータが必要です', atLeastOne: '1行以上のデータが必要です',
}, },
}, },
login: {
backToHome: 'ホームに戻る',
},
} }
export default translation export default translation

@ -73,6 +73,9 @@ const translation = {
atLeastOne: '上传文件的内容不能少于一条', atLeastOne: '上传文件的内容不能少于一条',
}, },
}, },
login: {
backToHome: '返回首页',
},
} }
export default translation export default translation

Loading…
Cancel
Save