From eb5987108e36136bc079873499f95567b9051029 Mon Sep 17 00:00:00 2001 From: Alberto Mac Date: Mon, 26 Aug 2024 18:52:46 +0100 Subject: revision, and minor fixes --- app/hello/page.tsx | 99 ------------------------------------------------------ 1 file changed, 99 deletions(-) delete mode 100644 app/hello/page.tsx (limited to 'app/hello') diff --git a/app/hello/page.tsx b/app/hello/page.tsx deleted file mode 100644 index 89e730e..0000000 --- a/app/hello/page.tsx +++ /dev/null @@ -1,99 +0,0 @@ -'use client' -import { signInWithEmailAndPassword } from "firebase/auth"; -import Link from "next/link"; -import { auth } from "../../services/firebase"; - -export default function Hello() { - let email = '' - let isValidEmail = '' - let setIsValidEmail = '' - let password = '' - let isValidPassword = '' - let setIsValidPassword = '' - let setIsPasswordVisible = '' - let se - - const emailValidation = () => { - const emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i; - if (!email || emailRegex.test(email) === false) { - setIsValidEmail(false); - return false; - } - setIsValidEmail(true); - return true; - }; - - const passwordValidation = () => { - const passwordRegex = /^(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+])[A-Za-z\d!@#$%^&*()_+]{8,}$/i; - - if (!password || passwordRegex.test(password) === false) { - setIsValidPassword(false) - return false - } - setIsValidPassword(true) - return true - } - - const debounce = fn => { - let id = null; - - return (...args) => { - if (id) { - clearTimeout(id); - } - id = setTimeout(() => { - fn(...args); - id = null; - }, 300); - }; - }; - - const loginUser = () => { - if (isValidEmail && isValidPassword) { - signInWithEmailAndPassword(auth, email, password) - .then(data => {console.log(data.user) - - console.log('User signed in successfully!'); - router.push('/browse'); - }) - // Navigate to the home screen or other desired screen - .catch(error => { - console.error(error); - // Display an error message to the user - }); - } - }; - - return ( -
-

Login

-
-
- - -
-
- - -
- -
- -
- Don't have an account?{' '} - -

Create account

- -
- -
- Forgot your password?{' '} - -

Recover

- -
-
- ); -} -- cgit v1.2.3-54-g00ecf