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 toast from 'svelte-french-toast';
//import { trackPageDuration, trackButtonClick} from '$lib/mixpanel';
import logo from '$lib/images/login_v2_logo.png';
import { numberOfUnreadNotification } from '$lib/store';
export let form;
let isClicked = false;
let loading = false;
let oauthLoading = false;
@ -32,6 +31,7 @@
break;
}
case 'redirect':
isClicked = true;
toast.success('Login successfully!', {
style: 'border-radius: 200px; background: #333; color: #fff;'});
await update();
@ -136,10 +136,21 @@
</div>
<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
</button>
{#if !loading && !isClicked}
<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 class="divider divider-[#fff] pt-5 pb-10">

View File

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

View File

@ -4,10 +4,10 @@
import Input from '$lib/components/Input.svelte';
import toast from 'svelte-french-toast';
import logo from '$lib/images/login_v2_logo.png';
export let form;
let isClicked = false;
let loading = false;
let oauthLoading = false;
@ -16,7 +16,9 @@
return async ({ result, update}) => {
switch (result.type) {
case 'success':
case 'redirect':
isClicked = true;
toast.success('Registration successfully!', {
style: 'border-radius: 200px; background: #333; color: #fff;'});
await update();
@ -37,21 +39,17 @@
}
}
let password = '';
let hasLetter = false;
let hasNumber = false;
let isLengthValid = false;
let hasSpecialChar = false;
/*
function checkPassword() {
hasLetter = /[a-zA-Z]/.test(password);
hasNumber = /\d/.test(password);
isLengthValid = password.length >= 8;
hasSpecialChar = /[!@#$%^&*()]/.test(password);
}
*/
let isHoveredGoogle = false;
@ -160,9 +158,19 @@
/>
<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]">
Register
</button>
{#if !loading && !isClicked}
<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">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>
<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>