mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #8102 from overleaf/msm-fix-sso-available
[Settings] Fix `ssoAvailable` not set GitOrigin-RevId: c3264682bcf3c1beb2050378875c164d960e15c1
This commit is contained in:
parent
f81c52e6c7
commit
5676ec2eed
3 changed files with 13 additions and 6 deletions
|
@ -12,6 +12,7 @@ import {
|
|||
} from '../../../context/user-email-context'
|
||||
import { UserEmailData } from '../../../../../../../types/user-email'
|
||||
import { UseAsyncReturnType } from '../../../../../shared/hooks/use-async'
|
||||
import { ssoAvailableForInstitution } from '../../../utils/sso'
|
||||
|
||||
const getDescription = (
|
||||
t: (s: string) => string,
|
||||
|
@ -26,8 +27,12 @@ const getDescription = (
|
|||
return t('make_email_primary_description')
|
||||
}
|
||||
|
||||
const ssoAvailable = ssoAvailableForInstitution(
|
||||
userEmailData.affiliation?.institution
|
||||
)
|
||||
|
||||
if (!institutionAlreadyLinked(state, userEmailData)) {
|
||||
return userEmailData.ssoAvailable
|
||||
return ssoAvailable
|
||||
? t('please_link_before_making_primary')
|
||||
: t('please_confirm_your_email_before_making_it_default')
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { useTranslation } from 'react-i18next'
|
||||
import { UserEmailData } from '../../../../../../types/user-email'
|
||||
import ResendConfirmationEmailButton from './resend-confirmation-email-button'
|
||||
import { ssoAvailableForInstitution } from '../../utils/sso'
|
||||
|
||||
type EmailProps = {
|
||||
userEmailData: UserEmailData
|
||||
|
@ -9,6 +10,10 @@ type EmailProps = {
|
|||
function Email({ userEmailData }: EmailProps) {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const ssoAvailable = ssoAvailableForInstitution(
|
||||
userEmailData.affiliation?.institution
|
||||
)
|
||||
|
||||
return (
|
||||
<>
|
||||
{userEmailData.email}
|
||||
|
@ -17,12 +22,10 @@ function Email({ userEmailData }: EmailProps) {
|
|||
<div className="small">
|
||||
<strong>
|
||||
{t('unconfirmed')}.
|
||||
{!userEmailData.ssoAvailable && (
|
||||
<span> {t('please_check_your_inbox')}.</span>
|
||||
)}
|
||||
{!ssoAvailable && <span> {t('please_check_your_inbox')}.</span>}
|
||||
</strong>
|
||||
<br />
|
||||
{!userEmailData.ssoAvailable && (
|
||||
{!ssoAvailable && (
|
||||
<ResendConfirmationEmailButton email={userEmailData.email} />
|
||||
)}
|
||||
</div>
|
||||
|
|
|
@ -6,6 +6,5 @@ export type UserEmailData = {
|
|||
email: string
|
||||
default: boolean
|
||||
samlProviderId?: string
|
||||
ssoAvailable?: boolean
|
||||
emailHasInstitutionLicence?: boolean
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue