mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-22 01:25:00 +02:00
TSK-808: ignore initial validation when autofilled for login form (#3012)
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
import { translate } from '@hcengineering/platform'
|
||||
|
||||
import login from '../plugin'
|
||||
import { onMount } from 'svelte'
|
||||
|
||||
interface Field {
|
||||
id?: string
|
||||
@@ -52,8 +53,10 @@
|
||||
export let secondaryButtonAction: (() => void) | undefined = undefined
|
||||
export let bottomActions: BottomAction[] = []
|
||||
export let object: any
|
||||
export let ignoreInitialValidation: boolean = false
|
||||
|
||||
async function validate () {
|
||||
if (ignoreInitialValidation) return
|
||||
for (const field of fields) {
|
||||
const v = object[field.name]
|
||||
const f = field
|
||||
@@ -99,6 +102,7 @@
|
||||
inAction = false
|
||||
})
|
||||
}
|
||||
onMount(() => (ignoreInitialValidation = false))
|
||||
|
||||
function trim (field: string): void {
|
||||
object[field] = (object[field] as string).trim()
|
||||
|
||||
@@ -108,4 +108,12 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Form caption={login.string.LogIn} {status} {fields} {object} {action} bottomActions={[recoveryAction, signUpAction]} />
|
||||
<Form
|
||||
caption={login.string.LogIn}
|
||||
{status}
|
||||
{fields}
|
||||
{object}
|
||||
{action}
|
||||
bottomActions={[recoveryAction, signUpAction]}
|
||||
ignoreInitialValidation
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user