register checkbox checker

This commit is contained in:
Ota Prokopec 2023-03-22 19:20:46 +01:00
parent a7c6f29e04
commit 740b6504d1
1 changed files with 5 additions and 7 deletions

View File

@ -7,7 +7,7 @@
import { getErrorMessage } from '../utils/authorizationErrors'
import { getUserByErantId } from '$lib/utils/database/users'
import { ID } from 'appwrite'
import { Helper } from 'flowbite-svelte'
import { Checkbox, Helper } from 'flowbite-svelte'
import Button from '$lib/components/Buttons/Button.svelte'
let email = ''
@ -15,10 +15,11 @@
let repeatPassword = ''
let name = ''
let erantId = ''
let policyChecked: boolean = false
let state: 'email-sent' | 'register' | 'loading' = 'register'
let error: string | null = null
$: buttonCodition = name.length > 0 && email.length > 0 && password.length >= 8 && password === repeatPassword && erantId.length > 2
$: buttonCodition = name.length > 0 && email.length > 0 && password.length >= 8 && password === repeatPassword && erantId.length > 2 && policyChecked
const register = async () => {
//if (password === repeatPassword || name.length < 8 || email.length < 8) throw new Error('conditions are not fine')
@ -63,12 +64,9 @@
<HiddenInput bind:value={password} placeholder="Password" />
<HiddenInput bind:value={repeatPassword} placeholder="Re-type password" />
<div class="flex items-center">
<input
id="link-checkbox"
type="checkbox"
value=""
<Checkbox
bind:checked={policyChecked}
class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
required
/>
<label for="link-checkbox" class="ml-2 text-sm font-medium text-gray-900 dark:text-gray-300"
>I agree with the <a href="erant.cz/terms-and-conditions" class="text-blue-600 dark:text-blue-500 hover:underline">terms and conditions</a>,