This commit is contained in:
MuslemRahimi 2024-07-24 20:24:49 +02:00
parent fb025280df
commit d9614ae3f9
3 changed files with 35 additions and 17 deletions

View File

@ -3,12 +3,11 @@
import Input from '$lib/components/Input.svelte'; import Input from '$lib/components/Input.svelte';
import toast from 'svelte-french-toast'; import toast from 'svelte-french-toast';
//import { trackPageDuration, trackButtonClick} from '$lib/mixpanel'; //import { trackPageDuration, trackButtonClick} from '$lib/mixpanel';
import logo from '$lib/images/login_v2_logo.png';
import { numberOfUnreadNotification } from '$lib/store'; import { numberOfUnreadNotification } from '$lib/store';
export let form; export let form;
let isClicked = false;
let loading = false; let loading = false;
let oauthLoading = false; let oauthLoading = false;
@ -32,6 +31,7 @@
break; break;
} }
case 'redirect': case 'redirect':
isClicked = true;
toast.success('Login successfully!', { toast.success('Login successfully!', {
style: 'border-radius: 200px; background: #333; color: #fff;'}); style: 'border-radius: 200px; background: #333; color: #fff;'});
await update(); await update();
@ -136,12 +136,23 @@
</div> </div>
<div class="w-full max-w-lg pt-5 m-auto pb-5"> <div class="w-full max-w-lg pt-5 m-auto pb-5">
<button type="submit" class="btn bg-purple-600 border border-gray-600 sm:hover:bg-purple-700 transition duration-100 text-white btn-md w-full rounded-lg m-auto text-white font-semibold text-[1rem]">
Login {#if !loading && !isClicked}
</button> <button type="submit" class="btn bg-purple-600 border border-gray-600 sm:hover:bg-purple-700 transition duration-100 text-white btn-md w-full rounded-lg m-auto text-white font-semibold text-[1rem]">
<span class="text-white">Login</span>
</button>
{:else}
<label class="cursor-not-allowed btn bg-purple-600 opacity-[0.5] border border-gray-600 sm:hover:bg-purple-700 transition duration-100 text-white btn-md w-full rounded-lg m-auto text-white font-semibold text-[1rem]">
<div class="flex flex-row m-auto items-center">
<span class="loading loading-infinity"></span>
<span class="text-white ml-1.5">Signing Up</span>
</div>
</label>
{/if}
</div> </div>
<div class="divider divider-[#fff] pt-5 pb-10"> <div class="divider divider-[#fff] pt-5 pb-10">
<span class="text-white text-[1rem] z-10">Or login using</span> <span class="text-white text-[1rem] z-10">Or login using</span>
</div> </div>

View File

@ -21,7 +21,6 @@ export const actions = {
const { formData, errors } = await validateData(await request.formData(), registerUserSchema); const { formData, errors } = await validateData(await request.formData(), registerUserSchema);
if (errors) { if (errors) {
console.log(errors.fieldErrors)
return fail(400, { return fail(400, {
data: formData, data: formData,
errors: errors.fieldErrors errors: errors.fieldErrors
@ -65,7 +64,7 @@ export const actions = {
*/ */
} catch (err) { } catch (err) {
console.log("Error: ", err); console.log("Error: ", err);
error(err.status, err.message); //error(err.status, err.message);
} }
redirect(301, "/"); redirect(301, "/");

View File

@ -4,10 +4,10 @@
import Input from '$lib/components/Input.svelte'; import Input from '$lib/components/Input.svelte';
import toast from 'svelte-french-toast'; import toast from 'svelte-french-toast';
import logo from '$lib/images/login_v2_logo.png';
export let form; export let form;
let isClicked = false;
let loading = false; let loading = false;
let oauthLoading = false; let oauthLoading = false;
@ -16,7 +16,9 @@
return async ({ result, update}) => { return async ({ result, update}) => {
switch (result.type) { switch (result.type) {
case 'success':
case 'redirect': case 'redirect':
isClicked = true;
toast.success('Registration successfully!', { toast.success('Registration successfully!', {
style: 'border-radius: 200px; background: #333; color: #fff;'}); style: 'border-radius: 200px; background: #333; color: #fff;'});
await update(); await update();
@ -37,21 +39,17 @@
} }
} }
let password = '';
let hasLetter = false;
let hasNumber = false;
let isLengthValid = false;
let hasSpecialChar = false;
/*
function checkPassword() { function checkPassword() {
hasLetter = /[a-zA-Z]/.test(password); hasLetter = /[a-zA-Z]/.test(password);
hasNumber = /\d/.test(password); hasNumber = /\d/.test(password);
isLengthValid = password.length >= 8; isLengthValid = password.length >= 8;
hasSpecialChar = /[!@#$%^&*()]/.test(password); hasSpecialChar = /[!@#$%^&*()]/.test(password);
} }
*/
let isHoveredGoogle = false; let isHoveredGoogle = false;
@ -160,9 +158,19 @@
/> />
<div class="w-full max-w-lg pt-5 m-auto pb-5"> <div class="w-full max-w-lg pt-5 m-auto pb-5">
<button type="submit" class="btn bg-purple-600 border border-gray-600 sm:hover:bg-purple-700 transition duration-100 text-white btn-md w-full rounded-lg m-auto text-white font-semibold text-[1rem]"> {#if !loading && !isClicked}
Register <button type="submit" class="btn bg-purple-600 border border-gray-600 sm:hover:bg-purple-700 transition duration-100 text-white btn-md w-full rounded-lg m-auto text-white font-semibold text-[1rem]">
</button> <span class="text-white">Register</span>
</button>
{:else}
<label class="cursor-not-allowed btn bg-purple-600 opacity-[0.5] border border-gray-600 sm:hover:bg-purple-700 transition duration-100 text-white btn-md w-full rounded-lg m-auto text-white font-semibold text-[1rem]">
<div class="flex flex-row m-auto items-center">
<span class="loading loading-infinity"></span>
<span class="text-white ml-1.5">Signing Up</span>
</div>
</label>
{/if}
</div> </div>
<p class="hidden sm:block pb-1 text-xs text-center w-full max-w-lg text-white">By registering you agree to stocknear's <p class="hidden sm:block pb-1 text-xs text-center w-full max-w-lg text-white">By registering you agree to stocknear's
<a href="/terms-of-use" class="text-blue-400 hover:underline">Terms of Use</a> <a href="/terms-of-use" class="text-blue-400 hover:underline">Terms of Use</a>