-
Notifications
You must be signed in to change notification settings - Fork 7
Group F - Sprint 3 - Token Expiry, Notifications & Renewal #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
16d2116
tokenExpiryChecks and reminder emails implemented
TheJob21 a7a64cd
Fixed some bugs, Tested functionality
TheJob21 be80fff
Token Renewal API with secure validation and expiry extension
22902b7
Implemented student dashboard with conditional UI and navigation
fbd3186
Add page for redirection after successful token renewal
kushi-3 05a2bd3
Remove unused variable
kushi-3 ed1458e
auto-deactivation changes
7649a53
Implemented Auto-Deactivation after token expiry
1e408f6
Merge pull request #123 from IPMS-Project/GroupF/token-expiry-monitor…
kushi-3 d7abafa
Revert "Remove unused variable"
kushi-3 86868e6
Revert "Add page for redirection after successful token renewal"
kushi-3 a039d99
Implemented Auto deactivation after token expiry with 24-hour window
47b3407
Implemented Auto deactivation after token expiry with 24-hour window …
cc2672f
Implemented Auto deactivation after token expiry with 24-hour window …
311d40a
Resolved conflicts
24fea5b
Merge branch 'GroupF/development' of https://github.com/IPMS-Project/…
kushi-3 e4a74d4
Merge pull request #125 from IPMS-Project/GroupF/studentDashboard
kushi-3 ab52519
Merge branch 'GroupF/development' of https://github.com/IPMS-Project/…
kushi-3 9205dc3
Update code to search for given token
kushi-3 72e6c5f
Add sooner id to the sign up
kushi-3 8c1dca6
Merge pull request #129 from IPMS-Project/GroupF/tokenrenewal
kushi-3 f242362
a1form scheme reference changed
d52df8a
Update to make sooner id field mandatory only to studnets
kushi-3 df706ca
Merge branch 'GroupF/development' of https://github.com/IPMS-Project/…
kushi-3 15f6fa3
Student Dashboard logic updated
f3b6bc4
Show renewal link for deactivated accounts on login page
kushi-3 4ef0dea
Merge branch 'GroupF/development' of https://github.com/IPMS-Project/…
kushi-3 29cb7a7
Merge branch 'main' of https://github.com/IPMS-Project/IPMS into Grou…
kushi-3 afa2f21
Resolve missing dependency issue
kushi-3 0659888
Remove unnecessary package.json
kushi-3 bad4057
Role based navigation added
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // src/components/ProtectedRouteStudent.js | ||
| import React from "react"; | ||
| import { Navigate } from "react-router-dom"; | ||
|
|
||
| const ProtectedRouteStudent = ({ children }) => { | ||
| const user = JSON.parse(localStorage.getItem("ipmsUser")); | ||
|
|
||
| // Check if user info is missing | ||
| if (!user || !user.id || !user.fullName) { | ||
| return <Navigate to="/" replace />; | ||
| } | ||
|
|
||
| return children; | ||
| }; | ||
|
|
||
| export default ProtectedRouteStudent; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| import React, { useEffect, useState } from "react"; | ||
| import { useNavigate } from "react-router-dom"; | ||
| import "../styles/StudentDashboard.css"; // Make sure you create this CSS | ||
|
|
||
| const StudentDashboard = () => { | ||
| const navigate = useNavigate(); | ||
|
|
||
| const user = JSON.parse(localStorage.getItem("ipmsUser")); | ||
| const ouEmail = user?.email; | ||
| const [approvalStatus, setApprovalStatus] = useState("not_submitted"); | ||
|
|
||
| useEffect(() => { | ||
| const fetchData = async () => { | ||
| try { | ||
| const res = await fetch(`${process.env.REACT_APP_API_URL}/api/student`, { | ||
| method: "POST", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| }, | ||
| body: JSON.stringify({ ouEmail }), | ||
| }); | ||
|
|
||
| const data = await res.json(); | ||
| setApprovalStatus(data.approvalStatus); | ||
| } catch (err) { | ||
| console.error("Error fetching internship data", err); | ||
| } | ||
| }; | ||
|
|
||
| if (ouEmail) { | ||
| fetchData(); | ||
| } | ||
| }, [ouEmail]); | ||
| console.log(approvalStatus); | ||
|
|
||
| return ( | ||
| <div className="student-dashboard"> | ||
| <div className="dashboard-header"> | ||
| <h2>Welcome, {user.fullName}</h2> | ||
| </div> | ||
|
|
||
| <div className="dashboard-card"> | ||
| {/* ------ FORM A1 Card ------ */} | ||
| <div className="card-section"> | ||
| <div className="card-content"> | ||
| <h3>Request Internship (FORM A1)</h3> | ||
| <p>Track your internship journey</p> | ||
|
|
||
| {approvalStatus === "not_submitted" && ( | ||
| <p style={{ fontSize: "0.85rem", color: "#888" }}> | ||
| You have not submitted the form yet | ||
| </p> | ||
| )} | ||
|
|
||
| {(approvalStatus === "submitted" || | ||
| approvalStatus === "pending manual review") && ( | ||
| <p style={{ fontSize: "0.85rem", color: "#888" }}> | ||
| Your form is submitted and under review | ||
| </p> | ||
| )} | ||
|
|
||
| {approvalStatus === "approved" && ( | ||
| <p style={{ fontSize: "0.85rem", color: "green" }}>Approved</p> | ||
| )} | ||
| </div> | ||
|
|
||
| <button | ||
| className="card-button" | ||
| onClick={() => { | ||
| if ( | ||
| approvalStatus === "draft" || | ||
| approvalStatus === "not_submitted" | ||
| ) { | ||
| navigate("/a1-form"); | ||
| } | ||
| }} | ||
| disabled={ | ||
| approvalStatus !== "draft" && approvalStatus !== "not_submitted" | ||
| } | ||
| style={{ | ||
| backgroundColor: | ||
| approvalStatus !== "draft" && approvalStatus !== "not_submitted" | ||
| ? "#ccc" | ||
| : "", | ||
| cursor: | ||
| approvalStatus !== "draft" && approvalStatus !== "not_submitted" | ||
| ? "not-allowed" | ||
| : "pointer", | ||
| }} | ||
| > | ||
| {approvalStatus === "approved" ? "Track" : "Request Internship"} | ||
| </button> | ||
| </div> | ||
|
|
||
| {/* ------ FORM A2 Card ------ */} | ||
| <div className="card-section"> | ||
| <div className="card-content"> | ||
| <h3>Weekly Report (Form A2)</h3> | ||
|
|
||
| {approvalStatus === "not_submitted" && ( | ||
| <p style={{ fontSize: "0.85rem", color: "#888" }}> | ||
| Please fill your Form A1 first | ||
| </p> | ||
| )} | ||
|
|
||
| {approvalStatus === "draft" && ( | ||
| <p style={{ fontSize: "0.85rem", color: "#888" }}> | ||
| Finish your Form A1 first | ||
| </p> | ||
| )} | ||
|
|
||
| {(approvalStatus === "submitted" || | ||
| approvalStatus === "pending manual review") && ( | ||
| <p style={{ fontSize: "0.85rem", color: "#888" }}> | ||
| Wait for your Form A1 to be approved | ||
| </p> | ||
| )} | ||
| </div> | ||
|
|
||
| <button | ||
| className="card-button" | ||
| disabled={approvalStatus !== "approved"} | ||
| onClick={() => { | ||
| if (approvalStatus === "approved") { | ||
| navigate("/weekly-report"); | ||
| } | ||
| }} | ||
| style={{ | ||
| backgroundColor: approvalStatus !== "approved" ? "#ccc" : "", | ||
| cursor: approvalStatus !== "approved" ? "not-allowed" : "pointer", | ||
| }} | ||
| > | ||
| Request | ||
| </button> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default StudentDashboard; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not remove the coordinator and supervisor-based navigation.
If any logic needs to be updated, adapt it accordingly without breaking role-based routing.
Alternatively, inform the respective team about the changes so they can adjust on their end.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The coordinator and supervisor-based navigation was never added from this side, I think it was a merge issue cause when I worked on student-dashboard navigation, there was no navigation logic for other roles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that this wasn’t added from your side, but I just want to clarify that this is not a merge issue. The coordinator and supervisor-based navigation was added by Team A (I believe), and the logic does exist. So please either add the necessary navigation logic accordingly or inform the respective team, so they can make the required adjustments