This commit is contained in:
Ota Prokopec 2023-01-26 18:18:07 +01:00
parent e806d848f2
commit 5096950ce4
3 changed files with 43 additions and 15 deletions

6
.env
View File

@ -1,8 +1,8 @@
# project endpoint (required) [example: http://localhost/v1]
VITE_APPWRITE_ENDPOINT=http://localhost/v1
VITE_APPWRITE_ENDPOINT=http://erant-deploy.erant.cz/v1
# project id (required) [example: 638871b363904655d784]
VITE_APPWRITE_PROJECT_ID=639f1cad34056246ee78
VITE_APPWRITE_PROJECT_ID=63af924ab3995db64755
# project hostname (required) [example: http://localhost:5173]
VITE_HOSTNAME=http://localhost:5173
VITE_HOSTNAME=http://erant-deploy.erant.cz

View File

@ -3,8 +3,9 @@
export let name = ''
export let placeholder = ''
export let value = ''
let input
export let input
let vissible = false
function changeVisibility(i) {
@ -19,7 +20,7 @@
</script>
<div>
<input bind:this={input} type="password" {name} {placeholder} minlength="8" class="input" required />
<input bind:value bind:this={input} type="password" {name} {placeholder} minlength="8" class="input" required />
<button type="button" on:click={changeVisibility(input)}>
<Eye active={vissible} />
</button>

View File

@ -1,9 +1,36 @@
<script>
import { account } from '$lib/appwrite'
import { ID } from 'appwrite'
import HiddenInput from '../lib/Components/Inputs/Hidden_Input.svelte'
import GoogleLogo from '../lib/svg/GoogleLogo.svelte'
import TopImage from '../lib/svg/Top-Image.svelte'
export let purpose = 'register' //possible values login, register
let email = 'otaprokopec@gmail.com'
let password = 'aaaaaaaa'
let repeatPassword = 'aaaaaaaa'
let name = 'Ota Prokopec'
$: console.log(password)
const register = async () => {
//if (password === repeatPassword || name.length < 8 || email.length < 8) throw new Error('conditions are not fine')
await account.create(ID.unique(), email, password, name)
await account.createEmailSession(email, password, name)
await account.createVerification(`${location.origin}/`)
}
//register email verification
/*const urlParams = new URLSearchParams(location.search)
const userId = urlParams.get('userId')
const secret = urlParams.get('secret')
;(async () => {
try {
await account.updateVerification(userId, secret)
navigate('/')
} catch (err) {
console.log(err)
}
})()*/
</script>
<div class="main">
@ -31,22 +58,22 @@
</form>
{:else}
<form>
<input type="text" placeholder="Name" autocomplete="full-name" required />
<input type="text" placeholder="E-mail" autocomplete="email" required />
<HiddenInput placeholder="Password" />
<HiddenInput placeholder="Re-type password" />
<input type="submit" value="Sign up" />
<input bind:value={name} type="text" placeholder="Name" autocomplete="full-name" required />
<input bind:value={email} type="text" placeholder="E-mail" autocomplete="email" required />
<HiddenInput bind:value={password} placeholder="Password" />
<HiddenInput bind:value={repeatPassword} placeholder="Re-type password" />
</form>
<button on:click={() => register()}>Sign up</button>
{/if}
</div>
<div class="continue_with">
<button>
<button on:click={() => account.createOAuth2Session('google')}>
<GoogleLogo />
<p>Continue with Google</p>
</button>
<button>
<button on:click={() => account.createOAuth2Session('facebook')}>
<p>Continue with Facebook</p>
</button>
</div>