TSK-808: ignore initial validation when autofilled for login form (#3012)

This commit is contained in:
Vyacheslav Tumanov 2023-04-19 06:09:35 +05:00 committed by GitHub
parent b93cb4e515
commit 76daba47ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -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()

View File

@ -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
/>