mirror of
https://github.com/suitenumerique/meet.git
synced 2026-07-26 11:58:53 +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
|
||||
|
||||
- ✨(frontend) allow disabling silent login via a URL parameter
|
||||
- ✨(frontend) allow hiding the login button via a URL parameter
|
||||
|
||||
### Changed
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import { VisualOnlyTooltip } from '@/primitives/VisualOnlyTooltip'
|
||||
|
||||
import { useLoginHint } from '@/hooks/useLoginHint'
|
||||
import { logout } from '@/features/auth/utils/logout'
|
||||
import { useMemo } from 'react'
|
||||
|
||||
const Logo = () => (
|
||||
<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 = () => {
|
||||
const { t } = useTranslation()
|
||||
const isHome = useMatchesRoute('home')
|
||||
@@ -92,6 +103,9 @@ export const Header = () => {
|
||||
const isTermsOfService = useMatchesRoute('termsOfService')
|
||||
const isRoom = useMatchesRoute('room')
|
||||
const { user, isLoggedIn } = useUser()
|
||||
|
||||
const loginButtonDisabledByUrl = useMemo(() => isLoginButtonHidden(), [])
|
||||
|
||||
const userLabel = user?.full_name || user?.email
|
||||
const loggedInTooltip = t('loggedInUserTooltip')
|
||||
const loggedInAriaLabel = userLabel
|
||||
@@ -152,7 +166,8 @@ export const Header = () => {
|
||||
!isHome &&
|
||||
!isLegalTerms &&
|
||||
!isAccessibility &&
|
||||
!isTermsOfService && (
|
||||
!isTermsOfService &&
|
||||
!loginButtonDisabledByUrl && (
|
||||
<>
|
||||
<LoginButton proConnectHint={false} />
|
||||
<LoginHint />
|
||||
|
||||
Reference in New Issue
Block a user