register checkbox checker
This commit is contained in:
parent
a7c6f29e04
commit
740b6504d1
|
@ -7,7 +7,7 @@
|
||||||
import { getErrorMessage } from '../utils/authorizationErrors'
|
import { getErrorMessage } from '../utils/authorizationErrors'
|
||||||
import { getUserByErantId } from '$lib/utils/database/users'
|
import { getUserByErantId } from '$lib/utils/database/users'
|
||||||
import { ID } from 'appwrite'
|
import { ID } from 'appwrite'
|
||||||
import { Helper } from 'flowbite-svelte'
|
import { Checkbox, Helper } from 'flowbite-svelte'
|
||||||
import Button from '$lib/components/Buttons/Button.svelte'
|
import Button from '$lib/components/Buttons/Button.svelte'
|
||||||
|
|
||||||
let email = ''
|
let email = ''
|
||||||
|
@ -15,10 +15,11 @@
|
||||||
let repeatPassword = ''
|
let repeatPassword = ''
|
||||||
let name = ''
|
let name = ''
|
||||||
let erantId = ''
|
let erantId = ''
|
||||||
|
let policyChecked: boolean = false
|
||||||
|
|
||||||
let state: 'email-sent' | 'register' | 'loading' = 'register'
|
let state: 'email-sent' | 'register' | 'loading' = 'register'
|
||||||
let error: string | null = null
|
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 () => {
|
const register = async () => {
|
||||||
//if (password === repeatPassword || name.length < 8 || email.length < 8) throw new Error('conditions are not fine')
|
//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={password} placeholder="Password" />
|
||||||
<HiddenInput bind:value={repeatPassword} placeholder="Re-type password" />
|
<HiddenInput bind:value={repeatPassword} placeholder="Re-type password" />
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<input
|
<Checkbox
|
||||||
id="link-checkbox"
|
bind:checked={policyChecked}
|
||||||
type="checkbox"
|
|
||||||
value=""
|
|
||||||
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"
|
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"
|
<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>,
|
>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>,
|
||||||
|
|
Loading…
Reference in New Issue