mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-31 12:47:58 +00:00
✨(frontend) allow hiding the login button via a URL parameter
Required by some self-hosters who want to present a link to participants that are guests only, without access to their SSO. For example, a meeting between a citizen and a public servant where the guest is known not to have an account. Also useful when rendering the join page inside an iframe.
This commit is contained in:
committed by
aleb_the_flash
parent
70a296eea6
commit
d4a7cf279c
@@ -11,6 +11,7 @@ and this project adheres to
|
|||||||
### Added
|
### Added
|
||||||
|
|
||||||
- ✨(frontend) allow disabling silent login via a URL parameter
|
- ✨(frontend) allow disabling silent login via a URL parameter
|
||||||
|
- ✨(frontend) allow hiding the login button via a URL parameter
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { VisualOnlyTooltip } from '@/primitives/VisualOnlyTooltip'
|
|||||||
|
|
||||||
import { useLoginHint } from '@/hooks/useLoginHint'
|
import { useLoginHint } from '@/hooks/useLoginHint'
|
||||||
import { logout } from '@/features/auth/utils/logout'
|
import { logout } from '@/features/auth/utils/logout'
|
||||||
|
import { useMemo } from 'react'
|
||||||
|
|
||||||
const Logo = () => (
|
const Logo = () => (
|
||||||
<img
|
<img
|
||||||
@@ -84,6 +85,16 @@ const LoginHint = () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const HIDE_LOGIN_PARAM = 'hideLogin'
|
||||||
|
|
||||||
|
const isLoginButtonHidden = () => {
|
||||||
|
if (typeof window === 'undefined') return false
|
||||||
|
const value = new URLSearchParams(window.location.search).get(
|
||||||
|
HIDE_LOGIN_PARAM
|
||||||
|
)
|
||||||
|
return value === 'true'
|
||||||
|
}
|
||||||
|
|
||||||
export const Header = () => {
|
export const Header = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const isHome = useMatchesRoute('home')
|
const isHome = useMatchesRoute('home')
|
||||||
@@ -92,6 +103,9 @@ export const Header = () => {
|
|||||||
const isTermsOfService = useMatchesRoute('termsOfService')
|
const isTermsOfService = useMatchesRoute('termsOfService')
|
||||||
const isRoom = useMatchesRoute('room')
|
const isRoom = useMatchesRoute('room')
|
||||||
const { user, isLoggedIn } = useUser()
|
const { user, isLoggedIn } = useUser()
|
||||||
|
|
||||||
|
const loginButtonDisabledByUrl = useMemo(() => isLoginButtonHidden(), [])
|
||||||
|
|
||||||
const userLabel = user?.full_name || user?.email
|
const userLabel = user?.full_name || user?.email
|
||||||
const loggedInTooltip = t('loggedInUserTooltip')
|
const loggedInTooltip = t('loggedInUserTooltip')
|
||||||
const loggedInAriaLabel = userLabel
|
const loggedInAriaLabel = userLabel
|
||||||
@@ -152,7 +166,8 @@ export const Header = () => {
|
|||||||
!isHome &&
|
!isHome &&
|
||||||
!isLegalTerms &&
|
!isLegalTerms &&
|
||||||
!isAccessibility &&
|
!isAccessibility &&
|
||||||
!isTermsOfService && (
|
!isTermsOfService &&
|
||||||
|
!loginButtonDisabledByUrl && (
|
||||||
<>
|
<>
|
||||||
<LoginButton proConnectHint={false} />
|
<LoginButton proConnectHint={false} />
|
||||||
<LoginHint />
|
<LoginHint />
|
||||||
|
|||||||
Reference in New Issue
Block a user