Skip to main content
Glama
SignInPage.tsx1.92 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { Title } from '@mantine/core'; import { getAppName, Logo, SignInForm, useMedplumProfile } from '@medplum/react'; import type { JSX } from 'react'; import { useCallback, useEffect } from 'react'; import { useNavigate, useSearchParams } from 'react-router'; import { getConfig, isRegisterEnabled } from './config'; export function SignInPage(): JSX.Element { const profile = useMedplumProfile(); const navigate = useNavigate(); const [searchParams] = useSearchParams(); const config = getConfig(); const navigateToNext = useCallback(() => { // only redirect to next if it is a pathname to avoid redirecting // to a maliciously crafted URL, e.g. /signin?next=https%3A%2F%2Fevil.com const nextUrl = searchParams.get('next'); navigate(nextUrl?.startsWith('/') ? nextUrl : '/')?.catch(console.error); }, [searchParams, navigate]); useEffect(() => { if (profile && searchParams.has('next')) { navigateToNext(); } }, [profile, searchParams, navigateToNext]); return ( <SignInForm onSuccess={() => navigateToNext()} onForgotPassword={() => navigate('/resetpassword')?.catch(console.error)} onRegister={isRegisterEnabled() ? () => navigate('/register')?.catch(console.error) : undefined} googleClientId={config.googleClientId} login={searchParams.get('login') || undefined} projectId={searchParams.get('project') || undefined} > <Logo size={32} /> {searchParams.get('project') !== 'new' && ( <Title order={3} py="lg" ta="center"> Sign in to {getAppName()} </Title> )} {searchParams.get('project') === 'new' && ( <Title order={3} py="lg" ta="center"> Sign in again to create a new project </Title> )} </SignInForm> ); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/medplum/medplum'

If you have feedback or need assistance with the MCP directory API, please join our Discord server