diff --git a/src/Pages/Login.js b/src/Pages/Login.js index 0aa0c1c..464d293 100644 --- a/src/Pages/Login.js +++ b/src/Pages/Login.js @@ -1,12 +1,9 @@ -import React, { useState, useEffect } from "react"; -import "./style.css"; -import "./utils.css"; -import loader_icon from "../assets/icons/loader_icon.gif"; +import { useState, useEffect } from "react"; import { useFirebase } from "../context/firebase"; import { getAuth, onAuthStateChanged } from "firebase/auth"; import { useNavigate, Link } from "react-router-dom"; -import { FaEye, FaEyeSlash } from "react-icons/fa"; -import "../components/Navbar.css"; +import { FaEye, FaEyeSlash, FaFilm, FaTicketAlt } from "react-icons/fa"; +import { PiPopcorn } from "react-icons/pi"; const Login = () => { const firebase = useFirebase(); @@ -17,7 +14,6 @@ const Login = () => { const [password, setPassword] = useState(""); const [isLoading, setIsLoading] = useState(false); const [isPasswordVisible, setIsPasswordVisible] = useState(false); - const [error, setError] = useState(""); const [emailError, setEmailError] = useState(""); const [passwordError, setPasswordError] = useState(""); @@ -28,8 +24,8 @@ const Login = () => { navigate("/Home"); } }); - document.title = "Login"; - }, [auth]); + document.title = "Login - Movie Tickets"; + }, [auth, navigate]); const resetErrors = () => { setError(""); @@ -45,14 +41,14 @@ const Login = () => { const validateForm = () => { let isValid = true; if (email === "") { - setEmailError("(Required Field)"); + setEmailError("Required"); isValid = false; } else if (!validateEmailFormat(email)) { - setEmailError("(Invalid Email Format)"); + setEmailError("Invalid format"); isValid = false; } if (password === "") { - setPasswordError("(Required Field)"); + setPasswordError("Required"); isValid = false; } return isValid; @@ -60,14 +56,11 @@ const Login = () => { const handleSignIn = () => { resetErrors(); - let isValid = validateForm(); - if (isValid) { + if (validateForm()) { setIsLoading(true); - setError(""); firebase .loginUserWithEmailAndPassword(email, password) .then(() => { - console.log("User logged in successfully!"); setEmail(""); setPassword(""); setError(""); @@ -76,7 +69,7 @@ const Login = () => { if (error.message === "Firebase: Error (auth/invalid-credential).") setError("Incorrect email or password"); else if (error.message === "Firebase: Error (auth/invalid-email).") - setEmailError("(Invalid Email)"); + setEmailError("Invalid Email"); else setError("Can't Sign In, Unexpected error occurred!"); }) .finally(() => { @@ -90,77 +83,159 @@ const Login = () => { }; return ( - <> -
+ Your gateway to cinematic adventures +
+