diff --git a/FrontEnd/src/assets/googleLogo.svg b/FrontEnd/src/assets/googleLogo.svg new file mode 100644 index 0000000..088288f --- /dev/null +++ b/FrontEnd/src/assets/googleLogo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/FrontEnd/src/assets/logo.svg b/FrontEnd/src/assets/logo.svg new file mode 100644 index 0000000..93d6402 --- /dev/null +++ b/FrontEnd/src/assets/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/FrontEnd/src/assets/logoLeaf.svg b/FrontEnd/src/assets/logoLeaf.svg new file mode 100644 index 0000000..48fe1d9 --- /dev/null +++ b/FrontEnd/src/assets/logoLeaf.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/FrontEnd/src/assets/react.svg b/FrontEnd/src/assets/react.svg deleted file mode 100644 index 6c87de9..0000000 --- a/FrontEnd/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/FrontEnd/src/components/common/Footer.jsx b/FrontEnd/src/components/common/Footer.jsx index da69834..deaaffa 100644 --- a/FrontEnd/src/components/common/Footer.jsx +++ b/FrontEnd/src/components/common/Footer.jsx @@ -1,6 +1,6 @@ import { Link } from 'react-router-dom'; import { FaFacebookF, FaInstagram, FaTwitter, FaYoutube } from 'react-icons/fa'; -import { ImLeaf } from 'react-icons/im'; +import logoLeaf from '../../assets/logoLeaf.svg'; const Footer = () => { return ( @@ -8,7 +8,7 @@ const Footer = () => {
- + logo AgroHelp diff --git a/FrontEnd/src/components/common/Navbar.jsx b/FrontEnd/src/components/common/Navbar.jsx index 58d20a2..3451d78 100644 --- a/FrontEnd/src/components/common/Navbar.jsx +++ b/FrontEnd/src/components/common/Navbar.jsx @@ -13,7 +13,7 @@ import { FaLock, FaPen, } from 'react-icons/fa'; -import { ImLeaf } from 'react-icons/im'; +import logoLeaf from '../../assets/logoLeaf.svg'; import { HiMenu, HiOutlineX } from 'react-icons/hi'; import { useGlobalContext } from '../../context/ContextProvider'; import { logout } from '../../api/user'; @@ -100,7 +100,7 @@ const Navbar = () => {
- + logo AgroHelp diff --git a/FrontEnd/src/pages/common/Login.jsx b/FrontEnd/src/pages/common/Login.jsx index 0dce1de..5436819 100644 --- a/FrontEnd/src/pages/common/Login.jsx +++ b/FrontEnd/src/pages/common/Login.jsx @@ -1,16 +1,23 @@ -import React from 'react'; import { useState, useEffect } from 'react'; import { Link, useNavigate, useLocation } from 'react-router-dom'; import { useGlobalContext } from '../../context/ContextProvider'; import { login } from '../../api/user'; -import { ImLeaf } from 'react-icons/im'; +import logo from '../../assets/logo.svg'; +import googleLogo from '../../assets/googleLogo.svg'; +import { IoIosEyeOff, IoIosEye } from 'react-icons/io'; const Login = () => { + const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); + const [showPassword, setShowPassword] = useState(false); + + const togglePasswordVisibility = () => { + setShowPassword(!showPassword); + }; const { setUser } = useGlobalContext(); - const { error, user } = useGlobalContext(); + const { user } = useGlobalContext(); const navigate = useNavigate(); const location = useLocation(); @@ -21,7 +28,30 @@ const Login = () => { if (user) { navigate(redirect); } - }, [navigate, user, redirect]); + const params = new URLSearchParams(location.search); + const token = params.get('token'); + const username = params.get('username'); + const email = params.get('email'); + const firstName = params.get('firstName'); + const lastName = params.get('lastName'); + const profilePic = params.get('profilePic'); + + if (token) { + const userData = { + token, + username, + email, + firstName, + lastName, + profilePic, + }; + + localStorage.setItem('userInfo', JSON.stringify(userData)); + setUser(userData); + + navigate('/home'); + } + }, [user, location, redirect, navigate, setUser]); const submitHandler = async (e) => { e.preventDefault(); @@ -30,356 +60,82 @@ const Login = () => { const { data } = await login(email, password); if (data) { setUser(data); + localStorage.setItem('userInfo', JSON.stringify(data)); + navigate(redirect); } } }; - return ( -
-