diff options
| author | Adam Soltys <[email protected]> | 2023-11-23 22:59:29 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-11-23 22:59:29 -0800 |
| commit | db102a23c272eb20c1d97f7d297cfad8d5e52951 (patch) | |
| tree | 213d597ecb2be67176e88ba8e11730f67c458ccc | |
| parent | 56372bbdd867e59797ae58692e2906440e96669e (diff) | |
| download | coinos-ui-auto-withdrawals.tar.gz coinos-ui-auto-withdrawals.zip | |
don't prefill registration formauto-withdrawals
| -rw-r--r-- | src/lib/store.js | 2 | ||||
| -rw-r--r-- | src/routes/(app)/register/+page.server.js | 21 | ||||
| -rw-r--r-- | src/routes/(app)/register/+page.svelte | 41 | ||||
| -rw-r--r-- | static/icons/random.svg | 6 |
4 files changed, 38 insertions, 32 deletions
diff --git a/src/lib/store.js b/src/lib/store.js index 64cf015e..3d8e687d 100644 --- a/src/lib/store.js +++ b/src/lib/store.js @@ -43,7 +43,7 @@ export const last = writable(); export const loginRedirect = writable(); export const decrypted = persistLocal('decrypted', {}); export const newPayment = persistLocal('newPayment'); -export const password = persistLocal('password'); +export const password = writable(); export const passwordPrompt = writable(); export const pin = writable(); export const rate = writable(); diff --git a/src/routes/(app)/register/+page.server.js b/src/routes/(app)/register/+page.server.js index f2b49e3f..45344907 100644 --- a/src/routes/(app)/register/+page.server.js +++ b/src/routes/(app)/register/+page.server.js @@ -1,10 +1,3 @@ -import { - NumberDictionary, - uniqueNamesGenerator, - colors, - adjectives, - animals -} from 'unique-names-generator'; import { fail, redirect } from '@sveltejs/kit'; import { fd, post, login } from '$lib/utils'; @@ -12,21 +5,9 @@ export const load = async ({ parent }) => { let { user } = await parent(); if (user) throw redirect(307, `/${user.username}`); - let username = uniqueNamesGenerator({ - dictionaries: [animals, NumberDictionary.generate({ min: 10, max: 99 })], - length: 2, - separator: '' - }); - - let password = uniqueNamesGenerator({ - dictionaries: [colors, NumberDictionary.generate({ min: 100, max: 999 })], - length: 2, - separator: '' - }); - let index = Math.floor(Math.random() * 64) + 1; - return { index, username, password }; + return { index }; }; export const actions = { diff --git a/src/routes/(app)/register/+page.svelte b/src/routes/(app)/register/+page.svelte index 573de4d0..a9f9d047 100644 --- a/src/routes/(app)/register/+page.svelte +++ b/src/routes/(app)/register/+page.svelte @@ -12,11 +12,20 @@ import { t } from '$lib/translations'; import { page } from '$app/stores'; import { generate } from '$lib/nostr'; + import { + NumberDictionary, + uniqueNamesGenerator, + colors, + adjectives, + animals + } from 'unique-names-generator'; export let form; export let data; $: data && ($avatar = undefined); + let username; + let { index } = data; let cleared; let clear = () => { @@ -29,16 +38,20 @@ }; let refresh = async () => { - await invalidateAll(); - await tick(); - username = data.username; - $password = data.password; - }; + username = uniqueNamesGenerator({ + dictionaries: [animals, NumberDictionary.generate({ min: 10, max: 99 })], + length: 2, + separator: '' + }); - let username = data.username; - $password = data.password; + $password = uniqueNamesGenerator({ + dictionaries: [colors, NumberDictionary.generate({ min: 100, max: 999 })], + length: 2, + separator: '' + }); - let { index } = data; + revealPassword = true; + }; afterNavigate(async () => { try { @@ -63,7 +76,7 @@ $: token && token?.length === 6 && tick().then(() => btn.click()); - let revealPassword = true; + let revealPassword; let loading; async function handleSubmit(e) { @@ -192,6 +205,8 @@ <div class="relative"> <label for="username" class="font-semibold">{$t('login.username')}</label> <input + use:focus + tabindex="1" name="username" type="text" required @@ -200,8 +215,8 @@ on:focus={clear} autocapitalize="none" /> - <button type="button" on:click={refresh} class="absolute right-0 top-4"> - <Icon icon="refresh" style="w-6 m-6" /> + <button type="button" on:click={refresh} class="absolute right-0 top-4" tabindex="5"> + <Icon icon="random" style="w-10 m-4" /> </button> </div> @@ -209,6 +224,7 @@ <label for="password" class="block font-semibold">{$t('login.password')}</label> {#if revealPassword} <input + tabindex="2" name="password" type="text" required @@ -218,6 +234,7 @@ /> {:else} <input + tabindex="2" name="password" type="password" required @@ -229,6 +246,7 @@ {/if} <button type="button" + tabindex="4" on:click={() => (revealPassword = !revealPassword)} class="absolute right-0 top-4" > @@ -241,6 +259,7 @@ </p> <button + tabindex="3" type="submit" class="bg-black text-white w-full rounded-2xl p-4 font-semibold hover:opacity-80" disabled={loading} diff --git a/static/icons/random.svg b/static/icons/random.svg new file mode 100644 index 00000000..f3e59233 --- /dev/null +++ b/static/icons/random.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools --> +<svg fill="#000000" width="800px" height="800px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg"> +<title>perspective-dice-random</title> +<path d="M15.676 17.312h0.048c-0.114-0.273-0.263-0.539-0.436-0.78l-11.114-6.346c-0.37 0.13-0.607 0.519-0.607 1.109v9.84c0 1.034 0.726 2.291 1.621 2.808l9.168 5.294c0.544 0.314 1.026 0.282 1.32-0.023v-11.902h-0zM10.049 24.234l-1.83-1.057v-1.918l1.83 1.057v1.918zM11.605 19.993c-0.132 0.2-0.357 0.369-0.674 0.505l-0.324 0.12c-0.23 0.090-0.38 0.183-0.451 0.278-0.071 0.092-0.106 0.219-0.106 0.38v0.242l-1.83-1.056v-0.264c0-0.294 0.056-0.523 0.167-0.685 0.111-0.165 0.346-0.321 0.705-0.466l0.324-0.125c0.193-0.076 0.333-0.171 0.421-0.285 0.091-0.113 0.137-0.251 0.137-0.417 0-0.251-0.081-0.494-0.243-0.728-0.162-0.237-0.389-0.44-0.679-0.608-0.274-0.158-0.569-0.268-0.887-0.329-0.318-0.065-0.649-0.078-0.994-0.040v-1.691c0.409 0.085 0.782 0.19 1.12 0.313s0.664 0.276 0.978 0.457c0.825 0.476 1.453 1.019 1.886 1.627 0.433 0.605 0.649 1.251 0.649 1.937 0 0.352-0.066 0.63-0.198 0.834zM27.111 8.247l-9.531-5.514c-0.895-0.518-2.346-0.518-3.241 0l-9.531 5.514c-0.763 0.442-0.875 1.117-0.336 1.628l10.578 6.040c0.583 0.146 1.25 0.145 1.832-0.003l10.589-6.060c0.512-0.508 0.392-1.17-0.36-1.605zM16.305 10.417l-0.23-0.129c-0.257-0.144-0.421-0.307-0.492-0.488-0.074-0.183-0.062-0.474 0.037-0.874l0.095-0.359c0.055-0.214 0.061-0.389 0.016-0.525-0.041-0.139-0.133-0.248-0.277-0.329-0.219-0.123-0.482-0.167-0.788-0.133-0.309 0.033-0.628 0.141-0.958 0.326-0.31 0.174-0.592 0.391-0.846 0.653-0.257 0.26-0.477 0.557-0.661 0.892l-1.476-0.827c0.332-0.333 0.658-0.625 0.978-0.875s0.659-0.474 1.015-0.674c0.934-0.524 1.803-0.835 2.607-0.934 0.8-0.101 1.5 0.016 2.098 0.352 0.307 0.172 0.508 0.368 0.603 0.589 0.092 0.219 0.097 0.507 0.016 0.865l-0.1 0.356c-0.066 0.255-0.080 0.438-0.041 0.55 0.035 0.11 0.124 0.205 0.265 0.284l0.212 0.118-2.074 1.162zM18.674 11.744l-1.673-0.937 2.074-1.162 1.673 0.937-2.074 1.162zM27.747 10.174l-11.060 6.329c-0.183 0.25-0.34 0.527-0.459 0.813v11.84c0.287 0.358 0.793 0.414 1.37 0.081l9.168-5.294c0.895-0.517 1.621-1.774 1.621-2.808v-9.84c0-0.608-0.251-1.003-0.641-1.121zM23.147 23.68l-1.83 1.056v-1.918l1.83-1.057v1.918zM24.703 17.643c-0.132 0.353-0.357 0.78-0.674 1.284l-0.324 0.494c-0.23 0.355-0.38 0.622-0.451 0.799-0.071 0.174-0.106 0.342-0.106 0.503v0.242l-1.83 1.056v-0.264c0-0.294 0.056-0.587 0.167-0.878 0.111-0.294 0.346-0.721 0.705-1.279l0.324-0.5c0.193-0.298 0.333-0.555 0.421-0.771 0.091-0.218 0.137-0.409 0.137-0.575 0-0.251-0.081-0.4-0.243-0.447-0.162-0.050-0.389 0.009-0.679 0.177-0.274 0.158-0.569 0.39-0.887 0.695-0.318 0.302-0.649 0.671-0.994 1.107v-1.692c0.409-0.387 0.782-0.714 1.12-0.981s0.664-0.491 0.978-0.673c0.825-0.476 1.453-0.659 1.886-0.55 0.433 0.106 0.649 0.502 0.649 1.188 0 0.352-0.066 0.706-0.198 1.062z"></path> +</svg>
\ No newline at end of file |
