Skip to content

Commit

Permalink
empty-array-paper
Browse files Browse the repository at this point in the history
  • Loading branch information
Kratik1093 committed Aug 27, 2024
1 parent 1580bf3 commit e8b1081
Show file tree
Hide file tree
Showing 21 changed files with 878 additions and 184 deletions.
42 changes: 42 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"install": "^0.13.0",
"npm": "^10.8.2",
"react-bootstrap-date-picker": "^5.1.0",
"react-dropzone": "^14.2.3",
"react-icons": "^5.3.0",
"react-modal": "^3.16.1",
"react-router-dom": "^6.26.1",
Expand Down
4 changes: 3 additions & 1 deletion src/AlertModal/AlertModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import React from 'react';
import PropTypes from 'prop-types';
import Modal from 'react-modal';
import './AlertModal.css';
import cross from "../Assets/cross-mark.svg";
import tick from "../Assets/accept-check-good-mark-ok-tick.svg";



const AlertModal = ({ isOpen, onClose, message,iserror }) => {
var image = iserror?'https://www.svgrepo.com/show/401368/cross-mark.svg':"https://www.svgrepo.com/show/384403/accept-check-good-mark-ok-tick.svg"
var image = iserror? cross : tick
return (
<Modal
isOpen={isOpen}
Expand Down
6 changes: 5 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import VerifyOtp from './Sign_up/VerifyOtp';
import Forgot_Password from './Forgot_Password/Forgot_Password';
import Reset_Password from './Reset_Password/Reset_Password';
import axios from 'axios';
import Question from './question/question';
import QuestionPaperDashboard from './QuestionPaperDashboard/QuestionPaperDashboard';

import Papers from './papers/papers'
import Question from './question/question'




Expand Down Expand Up @@ -64,6 +66,8 @@ const App = () => {
<>
<Route path="/teacherDashboard" element={<TeacherDashboard />} />
<Route path="/create-paper" element={<Createpaper />} />
<Route path="/add-question" element={<Question />} />
<Route path="/questionPaperDashboard" element={<QuestionPaperDashboard />}/>
</>
)}
<Route path="/papers" element={< Papers />} />
Expand Down
7 changes: 7 additions & 0 deletions src/Assets/accept-check-good-mark-ok-tick.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/Assets/cross-mark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/no-image-420x370-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/Assets/nothing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 52 additions & 13 deletions src/Forgot_Password/Forgot_Password.jsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,62 @@
import React from "react";
import React, { useState } from "react";
import Logo from "../Assets/iips_logo2.png";
import "./Forgot_Password.css";
import { useNavigate } from "react-router-dom";
const ForgotPassword=()=>
{
const navigate=useNavigate();
return(
<>
import axios from "axios";
import AlertModal from "../AlertModal/AlertModal";


const ForgotPassword = () => {
const [email, setEmail] = useState("");
const [message, setMessage] = useState("");
const [modalIsOpen, setModalIsOpen] = useState(false); // Modal state
const [isError, setIsError] = useState(false); // Error state for modal
const navigate = useNavigate();

const handleSubmit = async (e) => {
e.preventDefault();
try {
const response = await axios.post("http://localhost:5000/teacher/forgot-password", { email });
setMessage(response.data.message);
setIsError(false);
setModalIsOpen(true);
setTimeout(() => {
setModalIsOpen(false);
navigate("/Login");
}, 3000); // Optional: Navigate to login after 3 seconds
} catch (error) {
setMessage(error.response?.data?.error || "Something went wrong. Please try again.");
setIsError(true);
setModalIsOpen(true);
}
};

return (
<div className="forgot-container">
<img alt="Logo" src={Logo}/>
<h2> Forgot Your Password ?</h2>
<form onSubmit={()=> navigate("/Login")}>
<img alt="Logo" src={Logo} />
<h2>Forgot Your Password?</h2>
<form onSubmit={handleSubmit}>
<label>Email:</label>
<input type="email" name="forgot_email" placeholder="Enter your Email"/>
<input
type="email"
name="forgot_email"
placeholder="Enter your Email"
value={email}
onChange={(e) => setEmail(e.target.value)}
required
/>
<button type="submit">Submit</button>
</form>

{/* Use the AlertModal component */}
<AlertModal
isOpen={modalIsOpen}
onClose={() => setModalIsOpen(false)}
message={message}
iserror={isError}
/>
</div>
</>
);
}
};

export default ForgotPassword;
export default ForgotPassword;
14 changes: 14 additions & 0 deletions src/Login/Login.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,18 @@
width: 270px;
}

}
.eye-container
{
position: relative;
}
.eyes
{
position: absolute;
right: 10px;
top:22px;
}
.eyes:nth-child(2)
{
display: none;
}
42 changes: 35 additions & 7 deletions src/Login/Login.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { useState, useEffect } from "react";
import "./Login.css";
import logo from "../Assets/iips_logo2.png";
import { FaEye } from "react-icons/fa";
import { FaEyeSlash } from "react-icons/fa";
import axios from "axios";
import { useNavigate } from "react-router-dom";
import AlertModal from "../AlertModal/AlertModal";
Expand All @@ -14,7 +16,28 @@ function Login() {
const [modalMessage, setModalMessage] = useState("");
const [isError, setIsError] = useState(false);
const [isLoading, setIsLoading] = useState(false); // Loading state
const [t,setToggle] = useState("block");
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
Expand Down Expand Up @@ -116,13 +139,18 @@ function Login() {
<div>
<label>
Password:
<input
type="password"
placeholder="Enter Your Password"
value={password}
onChange={(e) => setPassword(e.target.value)}
required
/>
<div className="eye-container">
<input
type="password"
placeholder="Enter Your Password"
value={password}
onChange={(e) => setPassword(e.target.value)}
required
className="password-eye"
/>
<FaEye className="eyes" onClick={()=>toggled()}/>
<FaEyeSlash className="eyes" onClick={()=> toggled()}/>
</div>
</label>
</div>
{showOtp && (
Expand Down
Loading

0 comments on commit e8b1081

Please sign in to comment.