mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
add optional request password button to login page
This commit is contained in:
parent
fbe1eb9e0f
commit
a9d58b6b06
@ -170,7 +170,15 @@ function App() {
|
||||
<Routes>
|
||||
<Route path='/*' element={<MapContainer map={map} layers={layers} />}>
|
||||
<Route path='invite/:id' element={<InvitePage inviteApi={inviteApi} />} />
|
||||
<Route path='login' element={<LoginPage inviteApi={inviteApi} />} />
|
||||
<Route
|
||||
path='login'
|
||||
element={
|
||||
<LoginPage
|
||||
showRequestPassword={map.show_request_password}
|
||||
inviteApi={inviteApi}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<Route path='signup' element={<SignupPage />} />
|
||||
<Route
|
||||
path='reset-password'
|
||||
|
||||
@ -11,12 +11,13 @@ import type { InviteApi } from '#types/InviteApi'
|
||||
|
||||
interface Props {
|
||||
inviteApi: InviteApi
|
||||
showRequestPassword?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* @category Auth
|
||||
*/
|
||||
export function LoginPage({ inviteApi }: Props) {
|
||||
export function LoginPage({ inviteApi, showRequestPassword }: Props) {
|
||||
const [email, setEmail] = useState<string>('')
|
||||
const [password, setPassword] = useState<string>('')
|
||||
|
||||
@ -106,11 +107,13 @@ export function LoginPage({ inviteApi }: Props) {
|
||||
className='tw:input tw:input-bordered tw:w-full tw:max-w-xs'
|
||||
/>
|
||||
<div className='tw:text-right tw:text-primary'>
|
||||
<Link to='/reset-password'>
|
||||
<span className='tw:text-sm tw:inline-block tw:hover:text-primary tw:hover:underline tw:hover:cursor-pointer tw:transition tw:duration-200'>
|
||||
Forgot Password?
|
||||
</span>
|
||||
</Link>
|
||||
{!showRequestPassword && (
|
||||
<Link to='/reset-password'>
|
||||
<span className='tw:text-sm tw:inline-block tw:hover:text-primary tw:hover:underline tw:hover:cursor-pointer tw:transition tw:duration-200'>
|
||||
Forgot Password?
|
||||
</span>
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
<div className='tw:card-actions'>
|
||||
<button
|
||||
@ -124,6 +127,14 @@ export function LoginPage({ inviteApi }: Props) {
|
||||
>
|
||||
{loading ? <span className='tw:loading tw:loading-spinner'></span> : 'Login'}
|
||||
</button>
|
||||
{showRequestPassword && (
|
||||
<>
|
||||
<div className='tw:divider tw:w-full'>OR</div>
|
||||
<Link to='/reset-password' className='tw:w-full'>
|
||||
<button className='tw:btn tw:btn-primary tw:btn-block'>{'Request Password'}</button>
|
||||
</Link>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</MapOverlayPage>
|
||||
)
|
||||
|
||||
@ -37,7 +37,7 @@ export function RequestPasswordPage({ resetUrl }: { resetUrl: string }) {
|
||||
|
||||
return (
|
||||
<MapOverlayPage backdrop className='tw:max-w-xs tw:h-fit'>
|
||||
<h2 className='tw:text-2xl tw:font-semibold tw:mb-2 tw:text-center'>Reset Password</h2>
|
||||
<h2 className='tw:text-2xl tw:font-semibold tw:mb-2 tw:text-center'>Request Password</h2>
|
||||
<input
|
||||
type='email'
|
||||
placeholder='E-Mail'
|
||||
|
||||
1
lib/src/types/UtopiaMapProps.d.ts
vendored
1
lib/src/types/UtopiaMapProps.d.ts
vendored
@ -20,4 +20,5 @@ export interface UtopiaMapProps {
|
||||
expandLayerControl?: boolean
|
||||
tileServerUrl?: string
|
||||
tileServerAttribution?: string
|
||||
show_request_password?: boolean
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user