terms accept, password equaling

This commit is contained in:
Ota Prokopec 2023-03-26 20:13:34 +02:00
parent 59f98fadad
commit 2229a77225
2 changed files with 10 additions and 4 deletions

View File

@ -11,6 +11,7 @@
erantId: params.erantId,
userName: $user.name,
userId: $user.$id,
termsAccepted: true,
},
[Permission.delete(Role.user($user.$id)), Permission.update(Role.user($user.$id)), Permission.read(Role.users('verified'))],
)

View File

@ -15,11 +15,11 @@
let repeatPassword = ''
let name = ''
let erantId = ''
let policyChecked: boolean = false
let termsChecked: 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 && policyChecked
$: buttonCodition = name.length > 0 && email.length > 0 && password.length >= 8 && password === repeatPassword && erantId.length > 2 && termsChecked
const register = async () => {
//if (password === repeatPassword || name.length < 8 || email.length < 8) throw new Error('conditions are not fine')
@ -62,10 +62,15 @@
<input bind:value={email} type="text" placeholder="Your e-mail" autocomplete="email" required />
<input bind:value={erantId} type="text" placeholder="@your_nickname" autocomplete="email" required />
<HiddenInput bind:value={password} placeholder="Password" />
<HiddenInput bind:value={repeatPassword} placeholder="Re-type password" />
<div class="w-full">
<HiddenInput bind:value={repeatPassword} placeholder="Re-type password" />
{#if password !== repeatPassword && password.length >= 8}
<Helper class="flex justify-start w-full pl-4" helperClass="text-sm" color="red">Passwords are not equal</Helper>
{/if}
</div>
<div class="flex items-center">
<Checkbox
bind:checked={policyChecked}
bind:checked={termsChecked}
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"
/>
<label for="link-checkbox" class="ml-2 text-sm font-medium text-gray-900 dark:text-gray-300"