feat: add privacy agreement to signup

This commit is contained in:
Arman committed 2022-11-11 09:57:54 +01:00
1 parent 6bd86c50d3
commit d7a84789f3
2 files changed
+41 -4

No files matched your search

+23 -2
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { FormItem } from '.';
import { FormItem, Helper } from '.';
export let type: 'checkbox' | 'switchbox' = 'checkbox';
export let label: string;
@@ -8,6 +8,22 @@
export let value = false;
export let required = false;
export let disabled = false;
let element: HTMLInputElement;
let error: string;
const handleInvalid = (event: Event) => {
event.preventDefault();
if (element.validity.valueMissing) {
error = 'This field is required';
return;
}
error = element.validationMessage;
};
$: if (value) {
error = null;
}
</script>
<FormItem>
@@ -18,7 +34,9 @@
{required}
type="checkbox"
class:switch={type === 'switchbox'}
bind:checked={value} />
bind:this={element}
bind:checked={value}
on:invalid={handleInvalid} />
<div class="choice-item-content">
<div class:u-hide={!showLabel} class="choice-item-title">{label}</div>
@@ -27,4 +45,7 @@
{/if}
</div>
</label>
{#if error}
<Helper type="warning">{error}</Helper>
{/if}
</FormItem>
+18 -2
View File
@@ -5,6 +5,7 @@
Button,
Form,
FormItem,
InputChoice,
InputEmail,
InputPassword,
InputText
@@ -16,6 +17,7 @@
import { Dependencies } from '$lib/constants';
let name: string, mail: string, pass: string;
let terms = false;
const register = async () => {
try {
@@ -60,9 +62,23 @@
required={true}
showPasswordButton={true}
bind:value={pass} />
<InputChoice required bind:value={terms} id="terms" label="terms" showLabel={false}>
By registering, you agree that you have read, understand, and acknowledge our <a
class="link"
href="https://appwrite.io/policy/privacy"
target="_blank"
rel="noopener noreferrer">
Privacy Policy</a>
and accept our
<a
class="link"
href="https://appwrite.io/policy/terms"
target="_blank"
rel="noopener noreferrer">General Terms of Use</a>
.</InputChoice>
<FormItem>
<Button fullWidth submit>Sign up</Button></FormItem>
<Button fullWidth submit>Sign up</Button>
</FormItem>
</FormList>
</Form>
</svelte:fragment>