diff --git a/config.env b/config.env new file mode 100644 index 0000000..9214b52 --- /dev/null +++ b/config.env @@ -0,0 +1,2 @@ + +./package-lock.json \ No newline at end of file diff --git a/server/.gitignore b/server/.gitignore index 0326a4c..ffe0868 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -1,3 +1,4 @@ config.env /node_modules -package-lock.json \ No newline at end of file +package-lock.json +config.env \ No newline at end of file diff --git a/server/config/DBconnect.js b/server/config/DBconnect.js index bd4b6d6..cbc68f3 100644 --- a/server/config/DBconnect.js +++ b/server/config/DBconnect.js @@ -5,7 +5,7 @@ const connectDB = async () => { await mongoose.connect(process.env.DATABASE_URL); console.log("Connected To MongoDB"); } catch (err) { - console.log("DB Disconnected"); + console.log(err) process.exit(1); } }; diff --git a/server/index.js b/server/index.js index 1d0ccd4..8bcd57b 100644 --- a/server/index.js +++ b/server/index.js @@ -10,7 +10,7 @@ import StripeRouter from './routes/Stripe-route.js'; const app=express(); -dotenv.config({path:'./config.env'}); +dotenv.config({path:'./config.env'}) connectDB(); @@ -33,7 +33,6 @@ app.use('/api',StripeRouter); const port=process.env.PORT||7000; - app.listen(port,()=>{ console.log(`Server is running on port ${port}`); }) \ No newline at end of file diff --git a/src/Pages/Login.jsx b/src/Pages/Login.jsx index 5bac6bd..3f579bf 100644 --- a/src/Pages/Login.jsx +++ b/src/Pages/Login.jsx @@ -1,47 +1,124 @@ -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; import { Link, useNavigate } from "react-router-dom"; import google from '../assets/google.png' +import { IoEyeOutline, IoEyeOffOutline } from "react-icons/io5"; + const Login = () => { const [active, setActive] = useState(true); - + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + const [isEmailValid, setIsEmailValid] = useState(false); + const [isPasswordValid, setIsPasswordValid] = useState(false); + const [isEmailFocused, setIsEmailFocused] = useState(false); + const [isPasswordFocused, setIsPasswordFocused] = useState(false); + const [isPasswordVisible, setIsPasswordVisible] = useState(false); const navigate = useNavigate(); - const handleClicked = () => { - navigate("/signup"); - }; + const handleLogin = async (e) => { + e.preventDefault(); + console.log(email," ",password); + } return (

Login

- + + {isEmailFocused && !isEmailValid && ( +
+ * Email is not valid +
+ )} { + setEmail(e.target.value); + setIsEmailValid( + e.target.value.trim().length > 0 && + e.target.value.trim().includes("@") && + e.target.value.trim().includes(".") + ); + }} + onFocus={() => { + setIsEmailFocused(true); + setIsPasswordFocused(false); + }} /> - - -

+

{"Don't have an account?"} navigate("/signup")} > Sign Up

-
); diff --git a/src/Pages/Signup.jsx b/src/Pages/Signup.jsx index 5883805..23e7e60 100644 --- a/src/Pages/Signup.jsx +++ b/src/Pages/Signup.jsx @@ -1,7 +1,23 @@ import { useNavigate } from "react-router-dom"; - +import { useState } from "react"; +import { IoEyeOutline, IoEyeOffOutline } from "react-icons/io5"; const Signup = () => { const navigate = useNavigate(); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + const [confirmPassword, setConfirmPassword] = useState(""); + const [isEmailValid, setIsEmailValid] = useState(false); + const [isPasswordValid, setIsPasswordValid] = useState(false); + const [isEmailFocused, setIsEmailFocused] = useState(false); + const [isPasswordFocused, setIsPasswordFocused] = useState(false); + const [isConfirmPasswordValid,setIsConfirmPasswordValid] = useState(false) + const [isConfirmPasswordFocused,setIsConfirmPasswordFocused]=useState(false) + const [isPasswordVisible, setIsPasswordVisible] = useState(false); + const [isConfirmPasswordVisible, setConfirmIsPasswordVisible] = useState(false); + const handleSignUp = async (e) => { + e.preventDefault(); + console.log(email, " ", password," ",confirmPassword); + }; const handleClicked = () => { navigate("/login"); }; @@ -9,31 +25,150 @@ const Signup = () => {

Sign up

- + + {isEmailFocused && !isEmailValid && ( +
+ * Email is not valid +
+ )} { + setEmail(e.target.value); + setIsEmailValid( + e.target.value.trim().length > 0 && + e.target.value.trim().includes("@") && + e.target.value.trim().includes(".") + ); + }} + onFocus={() => { + setIsEmailFocused(true); + setIsPasswordFocused(false); + setIsConfirmPasswordFocused(false); + }} /> - + {isPasswordFocused && !isPasswordValid && ( +
+ * Password is not valid +
+ )} +
+ { + setPassword(e.target.value); + setIsPasswordValid( + e.target.value.trim().length > 0 && + e.target.value.trim().length >= 8 + ); + }} + onFocus={() => { + setIsEmailFocused(false); + setIsPasswordFocused(true); + setIsConfirmPasswordFocused(false); + }} + /> +
setIsPasswordVisible(!isPasswordVisible)} + > + {!isPasswordVisible ? ( + + ) : ( + + )} +
+
- - -

+

{"Already have an account?"}