mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-12 23:36:00 +00:00
feat(lib): add optional request password button to login page (#334)
* add optional request password button to login page * fix linting * fix linting * added field to backend config
This commit is contained in:
parent
1ef562cf3c
commit
a599eddca6
@ -168,7 +168,15 @@ function App() {
|
|||||||
<Routes>
|
<Routes>
|
||||||
<Route path='/*' element={<MapContainer map={map} layers={layers} />}>
|
<Route path='/*' element={<MapContainer map={map} layers={layers} />}>
|
||||||
<Route path='invite/:id' element={<InvitePage inviteApi={inviteApi} />} />
|
<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='signup' element={<SignupPage />} />
|
||||||
<Route
|
<Route
|
||||||
path='reset-password'
|
path='reset-password'
|
||||||
|
|||||||
@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
"collection": "maps",
|
||||||
|
"field": "show_request_password",
|
||||||
|
"type": "boolean",
|
||||||
|
"meta": {
|
||||||
|
"collection": "maps",
|
||||||
|
"conditions": null,
|
||||||
|
"display": null,
|
||||||
|
"display_options": null,
|
||||||
|
"field": "show_request_password",
|
||||||
|
"group": null,
|
||||||
|
"hidden": false,
|
||||||
|
"interface": "boolean",
|
||||||
|
"note": null,
|
||||||
|
"options": null,
|
||||||
|
"readonly": false,
|
||||||
|
"required": false,
|
||||||
|
"sort": 18,
|
||||||
|
"special": [
|
||||||
|
"cast-boolean"
|
||||||
|
],
|
||||||
|
"translations": null,
|
||||||
|
"validation": null,
|
||||||
|
"validation_message": null,
|
||||||
|
"width": "full"
|
||||||
|
},
|
||||||
|
"schema": {
|
||||||
|
"name": "show_request_password",
|
||||||
|
"table": "maps",
|
||||||
|
"data_type": "boolean",
|
||||||
|
"default_value": false,
|
||||||
|
"max_length": null,
|
||||||
|
"numeric_precision": null,
|
||||||
|
"numeric_scale": null,
|
||||||
|
"is_nullable": true,
|
||||||
|
"is_unique": false,
|
||||||
|
"is_indexed": false,
|
||||||
|
"is_primary_key": false,
|
||||||
|
"is_generated": false,
|
||||||
|
"generation_expression": null,
|
||||||
|
"has_auto_increment": false,
|
||||||
|
"foreign_key_table": null,
|
||||||
|
"foreign_key_column": null
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1955,6 +1955,7 @@ type maps {
|
|||||||
url: String
|
url: String
|
||||||
zoom: Int
|
zoom: Int
|
||||||
hide_signup: Boolean
|
hide_signup: Boolean
|
||||||
|
show_request_password: Boolean
|
||||||
layers(filter: layers_maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [layers_maps]
|
layers(filter: layers_maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [layers_maps]
|
||||||
layers_func: count_functions
|
layers_func: count_functions
|
||||||
}
|
}
|
||||||
@ -2002,6 +2003,7 @@ type maps_aggregated_count {
|
|||||||
url: Int
|
url: Int
|
||||||
zoom: Int
|
zoom: Int
|
||||||
hide_signup: Int
|
hide_signup: Int
|
||||||
|
show_request_password: Int
|
||||||
layers: Int
|
layers: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2676,6 +2678,7 @@ type version_maps {
|
|||||||
url: String
|
url: String
|
||||||
zoom: Int
|
zoom: Int
|
||||||
hide_signup: Boolean
|
hide_signup: Boolean
|
||||||
|
show_request_password: Boolean
|
||||||
layers: JSON
|
layers: JSON
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3225,6 +3228,7 @@ input create_maps_input {
|
|||||||
url: String
|
url: String
|
||||||
zoom: Int
|
zoom: Int
|
||||||
hide_signup: Boolean
|
hide_signup: Boolean
|
||||||
|
show_request_password: Boolean
|
||||||
layers: [create_layers_maps_input]
|
layers: [create_layers_maps_input]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4205,6 +4209,7 @@ input maps_filter {
|
|||||||
url: string_filter_operators
|
url: string_filter_operators
|
||||||
zoom: number_filter_operators
|
zoom: number_filter_operators
|
||||||
hide_signup: boolean_filter_operators
|
hide_signup: boolean_filter_operators
|
||||||
|
show_request_password: boolean_filter_operators
|
||||||
layers: layers_maps_quantifier_filter
|
layers: layers_maps_quantifier_filter
|
||||||
layers_func: count_function_filter_operators
|
layers_func: count_function_filter_operators
|
||||||
_and: [maps_filter]
|
_and: [maps_filter]
|
||||||
@ -4770,6 +4775,7 @@ input update_maps_input {
|
|||||||
url: String
|
url: String
|
||||||
zoom: Int
|
zoom: Int
|
||||||
hide_signup: Boolean
|
hide_signup: Boolean
|
||||||
|
show_request_password: Boolean
|
||||||
layers: [update_layers_maps_input]
|
layers: [update_layers_maps_input]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23103,6 +23103,10 @@
|
|||||||
"nullable": true,
|
"nullable": true,
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"show_request_password": {
|
||||||
|
"nullable": true,
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"layers": {
|
"layers": {
|
||||||
"nullable": true,
|
"nullable": true,
|
||||||
"type": "array",
|
"type": "array",
|
||||||
|
|||||||
@ -2040,6 +2040,7 @@ type maps {
|
|||||||
url: String
|
url: String
|
||||||
zoom: Int
|
zoom: Int
|
||||||
hide_signup: Boolean
|
hide_signup: Boolean
|
||||||
|
show_request_password: Boolean
|
||||||
layers(filter: layers_maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [layers_maps]
|
layers(filter: layers_maps_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [layers_maps]
|
||||||
layers_func: count_functions
|
layers_func: count_functions
|
||||||
}
|
}
|
||||||
@ -2785,6 +2786,7 @@ input create_maps_input {
|
|||||||
url: String
|
url: String
|
||||||
zoom: Int
|
zoom: Int
|
||||||
hide_signup: Boolean
|
hide_signup: Boolean
|
||||||
|
show_request_password: Boolean
|
||||||
layers: [create_layers_maps_input]
|
layers: [create_layers_maps_input]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3749,6 +3751,7 @@ input maps_filter {
|
|||||||
url: string_filter_operators
|
url: string_filter_operators
|
||||||
zoom: number_filter_operators
|
zoom: number_filter_operators
|
||||||
hide_signup: boolean_filter_operators
|
hide_signup: boolean_filter_operators
|
||||||
|
show_request_password: boolean_filter_operators
|
||||||
layers: layers_maps_quantifier_filter
|
layers: layers_maps_quantifier_filter
|
||||||
layers_func: count_function_filter_operators
|
layers_func: count_function_filter_operators
|
||||||
_and: [maps_filter]
|
_and: [maps_filter]
|
||||||
@ -4308,6 +4311,7 @@ input update_maps_input {
|
|||||||
url: String
|
url: String
|
||||||
zoom: Int
|
zoom: Int
|
||||||
hide_signup: Boolean
|
hide_signup: Boolean
|
||||||
|
show_request_password: Boolean
|
||||||
layers: [update_layers_maps_input]
|
layers: [update_layers_maps_input]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,12 +11,13 @@ import type { InviteApi } from '#types/InviteApi'
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
inviteApi: InviteApi
|
inviteApi: InviteApi
|
||||||
|
showRequestPassword?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Auth
|
* @category Auth
|
||||||
*/
|
*/
|
||||||
export function LoginPage({ inviteApi }: Props) {
|
export function LoginPage({ inviteApi, showRequestPassword }: Props) {
|
||||||
const [email, setEmail] = useState<string>('')
|
const [email, setEmail] = useState<string>('')
|
||||||
const [password, setPassword] = 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'
|
className='tw:input tw:input-bordered tw:w-full tw:max-w-xs'
|
||||||
/>
|
/>
|
||||||
<div className='tw:text-right tw:text-primary'>
|
<div className='tw:text-right tw:text-primary'>
|
||||||
<Link to='/reset-password'>
|
{!showRequestPassword && (
|
||||||
<span className='tw:text-sm tw:inline-block tw:hover:text-primary tw:hover:underline tw:hover:cursor-pointer tw:transition tw:duration-200'>
|
<Link to='/reset-password'>
|
||||||
Forgot 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'>
|
||||||
</span>
|
Forgot Password?
|
||||||
</Link>
|
</span>
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className='tw:card-actions'>
|
<div className='tw:card-actions'>
|
||||||
<button
|
<button
|
||||||
@ -124,6 +127,14 @@ export function LoginPage({ inviteApi }: Props) {
|
|||||||
>
|
>
|
||||||
{loading ? <span className='tw:loading tw:loading-spinner'></span> : 'Login'}
|
{loading ? <span className='tw:loading tw:loading-spinner'></span> : 'Login'}
|
||||||
</button>
|
</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>
|
</div>
|
||||||
</MapOverlayPage>
|
</MapOverlayPage>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -37,7 +37,7 @@ export function RequestPasswordPage({ resetUrl }: { resetUrl: string }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<MapOverlayPage backdrop className='tw:max-w-xs tw:h-fit'>
|
<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
|
<input
|
||||||
type='email'
|
type='email'
|
||||||
placeholder='E-Mail'
|
placeholder='E-Mail'
|
||||||
|
|||||||
1
lib/src/types/UtopiaMapProps.d.ts
vendored
1
lib/src/types/UtopiaMapProps.d.ts
vendored
@ -20,5 +20,6 @@ export interface UtopiaMapProps {
|
|||||||
expandLayerControl?: boolean
|
expandLayerControl?: boolean
|
||||||
tileServerUrl?: string
|
tileServerUrl?: string
|
||||||
tileServerAttribution?: string
|
tileServerAttribution?: string
|
||||||
|
show_request_password?: boolean
|
||||||
hideSignup?: boolean
|
hideSignup?: boolean
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user