diff --git a/services/web/frontend/js/features/settings/components/emails/add-email/sso-linking-info.tsx b/services/web/frontend/js/features/settings/components/emails/add-email/sso-linking-info.tsx index 9a4cbc530a..280d13e279 100644 --- a/services/web/frontend/js/features/settings/components/emails/add-email/sso-linking-info.tsx +++ b/services/web/frontend/js/features/settings/components/emails/add-email/sso-linking-info.tsx @@ -1,3 +1,5 @@ +import { useState } from 'react' +import { Button } from 'react-bootstrap' import { Trans, useTranslation } from 'react-i18next' import { DomainInfo } from './input' import { ExposedSettings } from '../../../../../../../types/exposed-settings' @@ -12,6 +14,14 @@ function SsoLinkingInfo({ domainInfo, email }: SSOLinkingInfoProps) { const { samlInitPath } = getMeta('ol-ExposedSettings') as ExposedSettings const { t } = useTranslation() + const [linkAccountsButtonDisabled, setLinkAccountsButtonDisabled] = + useState(false) + + function handleLinkAccountsButtonClick() { + setLinkAccountsButtonDisabled(true) + window.location.href = `${samlInitPath}?university_id=${domainInfo.university.id}&auto=/user/settings&email=${email}` + } + return ( <>
{domainInfo.university.name}
@@ -36,12 +46,14 @@ function SsoLinkingInfo({ domainInfo, email }: SSOLinkingInfoProps) { {t('find_out_more_about_institution_login')}. - {t('link_accounts_and_add_email')} - + > ) } diff --git a/services/web/frontend/js/features/settings/components/emails/row.tsx b/services/web/frontend/js/features/settings/components/emails/row.tsx index 7d093a7b44..8c5643e546 100644 --- a/services/web/frontend/js/features/settings/components/emails/row.tsx +++ b/services/web/frontend/js/features/settings/components/emails/row.tsx @@ -1,6 +1,7 @@ +import { useState } from 'react' import { Trans, useTranslation } from 'react-i18next' import { UserEmailData } from '../../../../../../types/user-email' -import { Row, Col } from 'react-bootstrap' +import { Button, Row, Col } from 'react-bootstrap' import Email from './email' import InstitutionAndRole from './institution-and-role' import EmailCell from './cell' @@ -59,6 +60,14 @@ function SSOAffiliationInfo({ userEmailData }: SSOAffiliationInfoProps) { const { t } = useTranslation() const { state } = useUserEmailsContext() + const [linkAccountsButtonDisabled, setLinkAccountsButtonDisabled] = + useState(false) + + function handleLinkAccountsButtonClick() { + setLinkAccountsButtonDisabled(true) + window.location.href = `${samlInitPath}?university_id=${userEmailData.affiliation?.institution?.id}&auto=/user/settings&email=${userEmailData.email}` + } + if ( !userEmailData.samlProviderId && institutionAlreadyLinked(state, userEmailData) @@ -127,12 +136,14 @@ function SSOAffiliationInfo({ userEmailData }: SSOAffiliationInfoProps) {