diff --git a/frontend/src/Login/ForgotPass.tsx b/frontend/src/Login/ForgotPass.tsx index e4a33b02..fe0cb3dc 100644 --- a/frontend/src/Login/ForgotPass.tsx +++ b/frontend/src/Login/ForgotPass.tsx @@ -12,7 +12,9 @@ export default function ForgotPass() { return (
- Logo +
navigate('/')}> + Logo +

Log in to

@@ -38,7 +40,12 @@ export default function ForgotPass() { // onChange={onchange} /> - @@ -46,7 +53,7 @@ export default function ForgotPass() {

Don't have an account ?

navigate('/register')} > Sign up diff --git a/frontend/src/Login/Login.tsx b/frontend/src/Login/Login.tsx index b5985bbc..55fe99ef 100644 --- a/frontend/src/Login/Login.tsx +++ b/frontend/src/Login/Login.tsx @@ -1,10 +1,60 @@ -import React from 'react'; +import React, { useState } from 'react'; import DocsGPT3 from '../assets/cute_docsgpt3.svg'; import { useNavigate } from 'react-router-dom'; export default function Login() { + const [showalert, setshowalert] = useState(''); + const [email, setemail] = useState(''); + const [password, setpassword] = useState(''); + const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); - console.log('login'); + + //email validation + if (email.length === 0 || password.length === 0) { + if (password.length === 0) { + setshowalert('Password is required'); + return; + } else { + setshowalert('Email is required'); + } + return; + } else { + setshowalert(''); + } + if (password.length === 0) { + setshowalert('Password is required'); + return; + } + + // const response = await fetch(`http://localhost:5000/api/auth/login`, { + // method: "POST", + // headers: { + // "Content-Type": "application/json", + // }, + // body: JSON.stringify({ + // Email: user.Email, + // Password: user.Password, + // }), + // }); + // const json = await response.json(); + // console.log(json); + // if (json.Check) { + // localStorage.setItem("token", json.authtoken); + // if (json?.status) + // { + // localStorage.setItem("isadmin" , true); + // } + // navigate("/"); + // } + // else if (!json.Check) + // { + // alert("Invalid Login Credentials") + // console.log("Invalid Login Cred") + // } + + alert('Login Successful '); + + navigate('/'); }; const navigate = useNavigate(); @@ -12,7 +62,9 @@ export default function Login() { return (
- Logo +
navigate('/')}> + Logo +

Log in to

@@ -27,6 +79,9 @@ export default function Login() { type="email" name="Name" placeholder="Email" + onChange={(e) => { + setemail(e.target.value); + }} className="w-full rounded-lg border-none bg-[#2B2B2B] p-4 text-sm font-medium text-white focus:outline-none md:min-w-[25vw]" // onChange={onchange} /> @@ -34,23 +89,29 @@ export default function Login() { type="password" name="Name" placeholder="Password" + onChange={(e) => { + setpassword(e.target.value); + }} className="w-full rounded-lg border-none bg-[#2B2B2B] p-4 text-sm font-medium text-white focus:outline-none md:min-w-[25vw]" // onChange={onchange} />

navigate('/Forgot')} > Forgot your password?

- + {showalert.length > 0 && ( +
{showalert}
+ )}

Don't have an account ?

navigate('/register')} > Sign up diff --git a/frontend/src/Login/ResetCode.tsx b/frontend/src/Login/ResetCode.tsx index aaf0f61d..6b15b829 100644 --- a/frontend/src/Login/ResetCode.tsx +++ b/frontend/src/Login/ResetCode.tsx @@ -1,5 +1,63 @@ import React from 'react'; - +import DocsGPT3 from '../assets/cute_docsgpt3.svg'; +import { useNavigate } from 'react-router-dom'; export default function ResetCode() { - return
ResetCode
; + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + console.log('login'); + }; + + const navigate = useNavigate(); + return ( +
+
+
navigate('/')}> + Logo +
+
+

Log in to

+

+ DocsGPT +

+
+
+
+

+ We've sent you instructions to reset your password. Please + check your inbox. +

+

+ If you haven't received an email in 5 minutes, check your + spam, resend, or try a different email. +

+
+ + + +
+
+

+ Don't have an account ? +

navigate('/register')} + > + Sign up +

+

+
+
+
+ ); } diff --git a/frontend/src/Login/Signup.tsx b/frontend/src/Login/Signup.tsx index 2b09ad3f..dae3dd83 100644 --- a/frontend/src/Login/Signup.tsx +++ b/frontend/src/Login/Signup.tsx @@ -5,7 +5,10 @@ import { useNavigate } from 'react-router-dom'; export default function Signup() { const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); - console.log('login'); + + alert('Signup Successful '); + + navigate('/login'); }; const navigate = useNavigate(); @@ -13,7 +16,9 @@ export default function Signup() { return (
- Logo +
navigate('/')}> + Logo +

Create

@@ -39,17 +44,17 @@ export default function Signup() { className="w-full rounded-lg border-none bg-[#2B2B2B] p-4 text-sm font-medium text-white focus:outline-none md:min-w-[25vw]" // onChange={onchange} /> -

Already have an account ?

navigate('/login')} > - log in + Log in

diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index 96415c1c..c797d652 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -1,6 +1,7 @@ import { Fragment, useEffect, useRef, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import Hero from '../Hero'; +import { useNavigate } from 'react-router-dom'; import { AppDispatch } from '../store'; import ConversationBubble from './ConversationBubble'; import { @@ -115,6 +116,8 @@ export default function Conversation() { document.execCommand('insertText', false, text); }; + const navigate = useNavigate(); + return (
{queries.length > 0 && !hasScrolledToLast && ( @@ -152,8 +155,23 @@ export default function Conversation() { {queries.length === 0 && ( )} +
+
+ + +