diff --git a/src/Login/Login.css b/src/Login/Login.css
index 50dacdd..953037f 100644
--- a/src/Login/Login.css
+++ b/src/Login/Login.css
@@ -106,8 +106,4 @@ min-height: 100vh;
position: absolute;
right: 10px;
top:22px;
- }
- .eyes:nth-child(2)
- {
- display: none;
}
\ No newline at end of file
diff --git a/src/Login/Login.jsx b/src/Login/Login.jsx
index 9f12736..2466600 100644
--- a/src/Login/Login.jsx
+++ b/src/Login/Login.jsx
@@ -16,25 +16,8 @@ function Login() {
const [modalMessage, setModalMessage] = useState("");
const [isError, setIsError] = useState(false);
const [isLoading, setIsLoading] = useState(false); // Loading state
- const [t, setToggle] = useState("block");
+ const [d, setDisplay] = useState(false);
const navigate = useNavigate(); // Initialize useNavigate
- const toggled = () => {
- const input = document.getElementsByClassName("password-eye")[0];
- const eyes1 = document.getElementsByClassName("eyes")[0];
- const eyes2 = document.getElementsByClassName("eyes")[1];
- if (t === "none") {
- eyes1.style.display = "none";
- eyes2.style.display = "block";
- input.type = "password";
- setToggle("block");
- }
- else {
- eyes2.style.display = "none";
- eyes1.style.display = "block";
- input.type = "text";
- setToggle("none");
- }
- }
useEffect(() => {
// Check if session ID exists in local storage and is still valid
@@ -56,7 +39,7 @@ function Login() {
const handleLogin = (e) => {
e.preventDefault();
- setIsLoading(true);
+ setIsLoading(true);
axios
.post("http://localhost:5000/teacher/login", { email, password })
@@ -84,7 +67,8 @@ function Login() {
axios
.post("http://localhost:5000/teacher/verify-otp", { email, otp })
.then((response) => {
- const { sessionId, message, teacherId, name, email, mobileNumber } = response.data;
+ const { sessionId, message, teacherId, name, email, mobileNumber } =
+ response.data;
// Set modal state first
setModalMessage(message);
@@ -124,67 +108,91 @@ function Login() {
return (
-
-
-
Teacher : Login
-
);
}
diff --git a/src/Reset_Password/Reset_Password.css b/src/Reset_Password/Reset_Password.css
index bd86321..8600654 100644
--- a/src/Reset_Password/Reset_Password.css
+++ b/src/Reset_Password/Reset_Password.css
@@ -86,10 +86,6 @@
{
cursor: pointer;
}
-.eye-icon
-{
- display: none;
-}
@media (max-width:720px)
{
.reset-container
diff --git a/src/Reset_Password/Reset_Password.jsx b/src/Reset_Password/Reset_Password.jsx
index 5504107..9dec4f4 100644
--- a/src/Reset_Password/Reset_Password.jsx
+++ b/src/Reset_Password/Reset_Password.jsx
@@ -7,135 +7,140 @@ import { useNavigate, useLocation } from "react-router-dom";
import AlertModal from "../AlertModal/AlertModal";
import Loader from "../Loader/Loader";
-
const Reset_Password = () => {
- const [password, setPassword] = useState("");
- const [confirmPassword, setConfirmPassword] = useState("");
- const [d0, setDisplay0] = useState("block");
- const [d1, setDisplay1] = useState("block");
- const [message, setMessage] = useState("");
- const [modalIsOpen, setModalIsOpen] = useState(false); // Modal state
- const [loading,setLoading] = useState(true);
- const [isError, setIsError] = useState(false); // Error state for modal
- const navigate = useNavigate();
- const location = useLocation();
+ const [password, setPassword] = useState("");
+ const [confirmPassword, setConfirmPassword] = useState("");
+ const [d1, setDisplay1] = useState(false);
+ const [d2, setDisplay2] = useState(false);
+ const [message, setMessage] = useState("");
+ const [modalIsOpen, setModalIsOpen] = useState(false); // Modal state
+ const [loading, setLoading] = useState(true);
+ const [isError, setIsError] = useState(false); // Error state for modal
+ const navigate = useNavigate();
+ const location = useLocation();
- useEffect(()=>
- {
- setTimeout(()=>{setLoading(false)},1000);
- },[]);
+ useEffect(() => {
+ setTimeout(() => {
+ setLoading(false);
+ }, 1000);
+ }, []);
- const toggleEye = (index) => {
- const input = document.getElementsByClassName("password-toggle")[index];
- const eye = document.getElementsByClassName("eye-icon")[index];
- const eye_slash = document.getElementsByClassName("eye-icon-slash")[index];
- if (index === 0) {
- if (d0 === "none") {
- eye.style.display = "none";
- eye_slash.style.display = "block";
- input.type = "password";
- setDisplay0("block");
- } else {
- eye_slash.style.display = "none";
- eye.style.display = "block";
- input.type = "text";
- setDisplay0("none");
- }
- } else {
- if (d1 === "none") {
- eye.style.display = "none";
- eye_slash.style.display = "block";
- input.type = "password";
- setDisplay1("block");
- } else {
- eye_slash.style.display = "none";
- eye.style.display = "block";
- input.type = "text";
- setDisplay1("none");
- }
- }
- };
+ const handleSubmit = async (e) => {
+ e.preventDefault();
+ if (password !== confirmPassword) {
+ setMessage("Passwords do not match");
+ setIsError(true);
+ setModalIsOpen(true);
+ return;
+ }
- const handleSubmit = async (e) => {
- e.preventDefault();
- if (password !== confirmPassword) {
- setMessage("Passwords do not match");
- setIsError(true);
- setModalIsOpen(true);
- return;
- }
+ const urlParams = new URLSearchParams(location.search);
+ const token = urlParams.get("token");
+ const email = urlParams.get("email");
- const urlParams = new URLSearchParams(location.search);
- const token = urlParams.get("token");
- const email = urlParams.get("email");
-
- try {
- const response = await axios.post("http://localhost:5000/teacher/reset-password", {
- token,
- email,
- newPassword: password,
- });
- setMessage(response.data.message);
- setIsError(false);
- setModalIsOpen(true);
- setTimeout(() => {
- setModalIsOpen(false);
- navigate("/Login");
- }, 3000);
- } catch (error) {
- setMessage(error.response?.data?.error || "Something went wrong. Please try again.");
- setIsError(true);
- setModalIsOpen(true);
+ try {
+ const response = await axios.post(
+ "http://localhost:5000/teacher/reset-password",
+ {
+ token,
+ email,
+ newPassword: password,
}
- };
+ );
+ setMessage(response.data.message);
+ setIsError(false);
+ setModalIsOpen(true);
+ setTimeout(() => {
+ setModalIsOpen(false);
+ navigate("/Login");
+ }, 3000);
+ } catch (error) {
+ setMessage(
+ error.response?.data?.error || "Something went wrong. Please try again."
+ );
+ setIsError(true);
+ setModalIsOpen(true);
+ }
+ };
- return (
-
- {loading ? (
) : (<>
-
+ return (
+
+ {loading ? (
+
+ ) : (
+ <>
+
- >)}
-
- );
+
+ >
+ )}
+
+ );
};
export default Reset_Password;
diff --git a/src/Sign_up/SignUp.jsx b/src/Sign_up/SignUp.jsx
index 9045115..93d16d9 100644
--- a/src/Sign_up/SignUp.jsx
+++ b/src/Sign_up/SignUp.jsx
@@ -21,53 +21,16 @@ const SignUp = () => {
const [alertMessage, setAlertMessage] = useState("");
const [isErrorAlert, setIsErrorAlert] = useState(false);
const [loading, setLoading] = useState(false); // Loading state for signup button
- const [loadingSpinner,setLoadingSpinner] = useState(true);
+ const [loadingSpinner, setLoadingSpinner] = useState(true);
const [isFirstClick, setIsFirstClick] = useState(true); // Track if it is the first click
- const [d0,setToggle0] = useState("block");
- const [d1,setToggle1] = useState("block");
+ const [d1, setDisplay1] = useState(false);
+ const [d2, setDisplay2] = useState(false);
- useEffect(()=>{setTimeout(()=>{setLoadingSpinner(false);},1000);},[]);
-
- const toggled=(index)=>
- {
- const input=document.getElementsByClassName("password-eye")[index];
- const eye0=document.getElementsByClassName("eye-icon-signup")[index];
- const eye1=document.getElementsByClassName("eye-icon-slash-signup")[index];
- if(index==0)
- {
- if(d0==="block")
- {
- eye1.style.display="none";
- eye0.style.display="block";
- input.type="text";
- setToggle0("none");
- }
- else
- {
- eye0.style.display="none";
- eye1.style.display="block";
- input.type="password";
- setToggle0("block");
- }
- }
- else
- {
- if(d1==="block")
- {
- eye1.style.display="none";
- eye0.style.display="block";
- input.type="text";
- setToggle1("none");
- }
- else
- {
- eye0.style.display="none";
- eye1.style.display="block";
- input.type="password";
- setToggle1("block");
- }
- }
- }
+ useEffect(() => {
+ setTimeout(() => {
+ setLoadingSpinner(false);
+ }, 1000);
+ }, []);
const handleChange = (e) => {
setFormData({
@@ -123,116 +86,149 @@ const SignUp = () => {
}
if (isFirstClick) {
- setIsWarningOpen(true);
- setIsFirstClick(false);
+ setIsWarningOpen(true);
+ setIsFirstClick(false);
} else {
- handleSignUp();
+ handleSignUp();
}
};
const handleWarningConfirm = () => {
- setIsWarningOpen(false);
+ setIsWarningOpen(false);
handleSignUp();
};
const handleAlertConfirm = () => {
- setIsAlertOpen(false);
- navigate("/verify_passcode");
+ setIsAlertOpen(false);
+ navigate("/verify_passcode");
};
return (
- {loadingSpinner ? (
) : (<>
-
-
-
Teacher : Sign Up
-