From 1df68f25ef02a0a985b2b647f3c138d869ff9899 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Tue, 29 Oct 2024 17:10:38 +0000
Subject: [PATCH 1/5] docs(contributor): contrib-readme-action has updated
readme
---
README.md | 138 ++++++++++--------------------------------------------
1 file changed, 25 insertions(+), 113 deletions(-)
diff --git a/README.md b/README.md
index d57a3ac..62862ae 100644
--- a/README.md
+++ b/README.md
@@ -259,20 +259,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Arindam
-
-
-
-
- Haseeb Zaki
-
- |
-
-
-
-
- Aryan Ramesh Jain
-
- |
@@ -280,8 +266,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
alolika bhowmik
|
-
-
@@ -296,6 +280,8 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Mahera Nayan
|
+
+
@@ -310,13 +296,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Tyarla Shirisha
|
-
-
-
-
- Nilanchal
-
- |
@@ -324,20 +303,18 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Aman Yadav
|
-
-
-
-
+
+
- Vinay Anand Lodhi
+ Nilanchal
|
-
-
+
+
- meghanakn22
+ Haseeb Zaki
|
@@ -347,13 +324,8 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Sawan kushwah
|
-
-
-
-
- Suman Bhadra
-
- |
+
+
@@ -368,8 +340,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Jay shah
|
-
-
@@ -377,13 +347,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Vishnu Prasad Korada
|
-
-
-
-
- Sourabh Singh Rawat
-
- |
@@ -405,27 +368,20 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Abhijit Motekar
|
+
+
Navneet Dadhich
- |
-
-
-
-
-
-
- Rudransh Pratap Singh
-
|
-
-
+
+
- Abhinandan
+ Vinay Anand Lodhi
|
@@ -458,13 +414,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
|
-
-
-
-
- vaishnavipal1869
-
- |
@@ -480,28 +429,19 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
|
-
-
+
+
- Shiva Bajpai
+ Sourabh Singh Rawat
|
-
-
+
+
- Pushpa Vishwakarma
+ Shiva Bajpai
|
-
-
-
-
- Mansi Sharma
-
- |
-
-
@@ -509,13 +449,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
MANI
|
-
-
-
-
- K N Meghana
-
- |
@@ -523,6 +456,8 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Ayush Yadav
|
+
+
@@ -544,8 +479,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Vaibhav-Kumar-K-R
|
-
-
@@ -567,13 +500,8 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Sapna Kul
|
-
-
-
-
- Nikhil More
-
- |
+
+
@@ -588,8 +516,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Mohit Rana
|
-
-
@@ -597,13 +523,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Jai Dhingra
|
-
-
-
-
- Harjas Singh
-
- |
@@ -618,13 +537,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
CHIKATLA RAKESH
|
-
-
-
-
- Anushka Chouhan
-
- |
From 7df9c259abbf58e5fa39d2720f0c3661f85d429d Mon Sep 17 00:00:00 2001
From: haseebzaki-07
Date: Tue, 29 Oct 2024 22:44:19 +0530
Subject: [PATCH 2/5] verified users
---
backend/routes/eventRouter.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/backend/routes/eventRouter.js b/backend/routes/eventRouter.js
index 1cd9d77..a0b3670 100644
--- a/backend/routes/eventRouter.js
+++ b/backend/routes/eventRouter.js
@@ -25,6 +25,7 @@ router.get("/", async (req, res) => {
res.status(500).json({ error: "Internal server error" });
}
});
+
router.post("/create",authenticateCustomer, createEvent);
router.get("/all",authenticateCustomer, getEvents);
router.get("/delete",authenticateCustomer, deleteEvent);
From 88e51c4ee5791d154327ffb729a5331afa258658 Mon Sep 17 00:00:00 2001
From: haseebzaki-07
Date: Tue, 29 Oct 2024 22:55:12 +0530
Subject: [PATCH 3/5] add verified users
---
README.md | 143 +++++++++++++++++++-----
backend/middlewares/authCustomer.js | 48 +++++---
backend/routes/eventRouter.js | 1 +
frontend/src/components/Pages/Event.jsx | 14 ++-
4 files changed, 159 insertions(+), 47 deletions(-)
diff --git a/README.md b/README.md
index 62862ae..c2ec761 100644
--- a/README.md
+++ b/README.md
@@ -259,6 +259,20 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Arindam
|
+
+
+
+
+ Haseeb Zaki
+
+ |
+
+
+
+
+ Aryan Ramesh Jain
+
+ |
@@ -266,6 +280,8 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
alolika bhowmik
|
+
+
@@ -280,8 +296,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Mahera Nayan
|
-
-
@@ -296,6 +310,13 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Tyarla Shirisha
|
+
+
+
+
+ Nilanchal
+
+ |
@@ -303,18 +324,20 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Aman Yadav
|
+
+
-
-
+
+
- Nilanchal
+ Vinay Anand Lodhi
|
-
-
+
+
- Haseeb Zaki
+ meghanakn22
|
@@ -324,8 +347,13 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Sawan kushwah
|
-
-
+
+
+
+
+ Suman Bhadra
+
+ |
@@ -340,6 +368,8 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Jay shah
|
+
+
@@ -347,6 +377,13 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Vishnu Prasad Korada
|
+
+
+
+
+ Sourabh Singh Rawat
+
+ |
@@ -368,8 +405,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Abhijit Motekar
|
-
-
@@ -377,11 +412,20 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Navneet Dadhich
|
+
+
-
-
+
+
- Vinay Anand Lodhi
+ Rudransh Pratap Singh
+
+ |
+
+
+
+
+ Abhinandan
|
@@ -414,6 +458,13 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
|
+
+
+
+
+ vaishnavipal1869
+
+ |
@@ -429,19 +480,28 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
|
-
-
+
+
- Sourabh Singh Rawat
+ Shiva Bajpai
|
-
-
+
+
- Shiva Bajpai
+ Pushpa Vishwakarma
|
+
+
+
+
+ Mansi Sharma
+
+ |
+
+
@@ -449,6 +509,13 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
MANI
|
+
+
+
+
+ K N Meghana
+
+ |
@@ -456,8 +523,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Ayush Yadav
|
-
-
@@ -479,6 +544,8 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Vaibhav-Kumar-K-R
|
+
+
@@ -500,8 +567,13 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Sapna Kul
|
-
-
+
+
+
+
+ Nikhil More
+
+ |
@@ -516,6 +588,8 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Mohit Rana
|
+
+
@@ -523,6 +597,13 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Jai Dhingra
|
+
+
+
+
+ Harjas Singh
+
+ |
@@ -537,6 +618,13 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
CHIKATLA RAKESH
|
+
+
+
+
+ Anushka Chouhan
+
+ |
@@ -600,7 +688,4 @@ Stay updated and engage with our community on social media:
- [LinkedIn](https://www.linkedin.com/in/ramakrushna-biswal/)
- [Email](mailto:ramakrushnabunty@gmail.com)
-We are always here to help you! Don’t hesitate to connect with us and be part of the PlayCafe journey.
-
-
-
+We are always here to help you! Don’t hesitate to connect with us and be part of the PlayCafe journey.
\ No newline at end of file
diff --git a/backend/middlewares/authCustomer.js b/backend/middlewares/authCustomer.js
index eb17509..b65b508 100644
--- a/backend/middlewares/authCustomer.js
+++ b/backend/middlewares/authCustomer.js
@@ -1,24 +1,38 @@
const jwt = require("jsonwebtoken");
const logger = require("../config/logger");
const config = require("../config/secret");
+const Customer = require("../models/customer.model");
-const authenticateCustomer = (req, res, next) => {
- const token = req.header("Authorization")?.split(" ")[1]; // Expecting "Bearer "
-
- if (token) {
- jwt.verify(token, config.JWT_SECRET, (err, user) => {
- if (err) {
- if (err.name === "TokenExpiredError") {
- return res.status(401).json({ message: "Token expired" });
- }
- return res.status(403).json({ message: "Invalid token" });
- }
- req.user = user;
- logger.info(`Customer authenticated: ${JSON.stringify(user.username)}`);
- next();
- });
- } else {
- res.sendStatus(401); // Unauthorized
+
+const authenticateCustomer = async (req, res, next) => {
+ const token = req.header("Authorization")?.split(" ")[1];
+
+ if (!token) {
+ return res.status(401).json({ message: "Authorization token is missing" });
+ }
+
+ try {
+ const decoded = jwt.verify(token, config.JWT_SECRET);
+
+ const user = await Customer.findById(decoded.sub);
+
+ if (!user) {
+ return res.status(404).json({ message: "User not found" });
+ }
+
+ if (!user.isVerified) {
+ return res.status(403).json({ message: "Account not verified" });
+ }
+
+ req.user = user;
+ logger.info(`Customer authenticated: ${user.name}`);
+ next();
+ } catch (err) {
+ if (err.name === "TokenExpiredError") {
+ return res.status(401).json({ message: "Token expired" });
+ }
+ logger.error("Token verification failed:", err);
+ return res.status(403).json({ message: "Invalid token" });
}
};
diff --git a/backend/routes/eventRouter.js b/backend/routes/eventRouter.js
index c025b10..a6e7c1d 100644
--- a/backend/routes/eventRouter.js
+++ b/backend/routes/eventRouter.js
@@ -5,6 +5,7 @@ const {
getEvents,
deleteEvent,
} = require("../controller/event.controller");
+const authenticateCustomer = require("../middlewares/authCustomer");
const router = express.Router();
diff --git a/frontend/src/components/Pages/Event.jsx b/frontend/src/components/Pages/Event.jsx
index d60a3fc..0b5dfe6 100644
--- a/frontend/src/components/Pages/Event.jsx
+++ b/frontend/src/components/Pages/Event.jsx
@@ -14,6 +14,8 @@ import game from '../../assets/Boardgames/carrom.gif';
import spin from '../../assets/Boardgames/spin.gif';
import MainHOC from '../MainHOC';
const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
+import { useNavigate } from 'react-router-dom';
+import Cookies from 'js-cookie';
const months = [
'January',
'February',
@@ -31,6 +33,16 @@ const months = [
function Event() {
const [events, setEvents] = useState([]);
const [error, setError] = useState(null);
+ const navigate = useNavigate();
+
+ const handleRegisterClick = () => {
+ const isAuthenticated = Boolean(Cookies.get('authToken'));
+
+ if (!isAuthenticated) {
+ alert("Please sign in to register for the event.");
+ navigate('/login');
+ }
+ };
useEffect(() => {
const fetchData = async () => {
try {
@@ -183,7 +195,7 @@ function Event() {
))}
-
From cfa44099a011dcb82e3fb4b47eb7ebddcd9fa141 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Tue, 29 Oct 2024 17:25:38 +0000
Subject: [PATCH 4/5] docs(contributor): contrib-readme-action has updated
readme
---
README.md | 138 ++++++++++--------------------------------------------
1 file changed, 25 insertions(+), 113 deletions(-)
diff --git a/README.md b/README.md
index c2ec761..28a1537 100644
--- a/README.md
+++ b/README.md
@@ -259,20 +259,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Arindam
|
-
-
-
-
- Haseeb Zaki
-
- |
-
-
-
-
- Aryan Ramesh Jain
-
- |
@@ -280,8 +266,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
alolika bhowmik
|
-
-
@@ -296,6 +280,8 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Mahera Nayan
|
+
+
@@ -310,13 +296,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Tyarla Shirisha
|
-
-
-
-
- Nilanchal
-
- |
@@ -324,20 +303,18 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Aman Yadav
|
-
-
-
-
+
+
- Vinay Anand Lodhi
+ Nilanchal
|
-
-
+
+
- meghanakn22
+ Haseeb Zaki
|
@@ -347,13 +324,8 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Sawan kushwah
|
-
-
-
-
- Suman Bhadra
-
- |
+
+
@@ -368,8 +340,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Jay shah
|
-
-
@@ -377,13 +347,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Vishnu Prasad Korada
|
-
-
-
-
- Sourabh Singh Rawat
-
- |
@@ -405,27 +368,20 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Abhijit Motekar
|
+
+
Navneet Dadhich
- |
-
-
-
-
-
-
- Rudransh Pratap Singh
-
|
-
-
+
+
- Abhinandan
+ Vinay Anand Lodhi
|
@@ -458,13 +414,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
|
-
-
-
-
- vaishnavipal1869
-
- |
@@ -480,28 +429,19 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
|
-
-
+
+
- Shiva Bajpai
+ Sourabh Singh Rawat
|
-
-
+
+
- Pushpa Vishwakarma
+ Shiva Bajpai
|
-
-
-
-
- Mansi Sharma
-
- |
-
-
@@ -509,13 +449,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
MANI
|
-
-
-
-
- K N Meghana
-
- |
@@ -523,6 +456,8 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Ayush Yadav
|
+
+
@@ -544,8 +479,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Vaibhav-Kumar-K-R
|
-
-
@@ -567,13 +500,8 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Sapna Kul
|
-
-
-
-
- Nikhil More
-
- |
+
+
@@ -588,8 +516,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Mohit Rana
|
-
-
@@ -597,13 +523,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Jai Dhingra
|
-
-
-
-
- Harjas Singh
-
- |
@@ -618,13 +537,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
CHIKATLA RAKESH
|
-
-
-
-
- Anushka Chouhan
-
- |
From 3485129f0716d2a1d45044667838e89fad7981f4 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Wed, 30 Oct 2024 14:32:12 +0000
Subject: [PATCH 5/5] docs(contributor): contrib-readme-action has updated
readme
---
README.md | 159 +++++++++++-------------------------------------------
1 file changed, 31 insertions(+), 128 deletions(-)
diff --git a/README.md b/README.md
index f9e3a28..28a1537 100644
--- a/README.md
+++ b/README.md
@@ -259,20 +259,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Arindam
|
-
-
-
-
- Haseeb Zaki
-
- |
-
-
-
-
- Aryan Ramesh Jain
-
- |
@@ -280,8 +266,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
alolika bhowmik
|
-
-
@@ -289,13 +273,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Ashwini_ab
|
-
-
-
-
- Tejas Benibagde
-
- |
@@ -303,29 +280,22 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Mahera Nayan
|
+
+
-
-
-
- Tyarla Shirisha
-
- |
-
-
-
+
+
- meghanakn22
+ Tejas Benibagde
|
-
-
+
+
- Vinay Anand Lodhi
+ Tyarla Shirisha
|
-
-
@@ -341,17 +311,10 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
|
-
-
-
- Suhas Koheda
-
- |
-
-
-
+
+
- Suman Bhadra
+ Haseeb Zaki
|
@@ -361,15 +324,15 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Sawan kushwah
|
+
+
-
-
+
+
- Rudransh Pratap Singh
+ Suhas Koheda
|
-
-
@@ -384,13 +347,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Vishnu Prasad Korada
|
-
-
-
-
- Sourabh Singh Rawat
-
- |
@@ -422,10 +378,10 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
|
-
-
+
+
- Abhinandan
+ Vinay Anand Lodhi
|
@@ -435,13 +391,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Vishal Lade
|
-
-
-
-
- Anushka Chouhan
-
- |
@@ -456,8 +405,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
t rahul prabhu
|
-
-
@@ -465,13 +412,8 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Aditya Bakshi
|
-
-
-
-
- vaishnavipal1869
-
- |
+
+
@@ -487,26 +429,17 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
|
-
-
-
- Shiva Bajpai
-
- |
-
-
-
+
+
- Pushpa Vishwakarma
+ Sourabh Singh Rawat
|
-
-
-
-
+
+
- Mansi Sharma
+ Shiva Bajpai
|
@@ -516,13 +449,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
MANI
|
-
-
-
-
- K N Meghana
-
- |
@@ -530,6 +456,8 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Ayush Yadav
|
+
+
@@ -544,8 +472,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Vaibhav._Y
|
-
-
@@ -574,13 +500,8 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Sapna Kul
|
-
-
-
-
- Nikhil More
-
- |
+
+
@@ -588,8 +509,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Bashua Mutiat
|
-
-
@@ -604,20 +523,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
Jai Dhingra
|
-
-
-
-
- Vivek Prakash
-
- |
-
-
-
-
- Harjas Singh
-
- |
@@ -632,8 +537,6 @@ We extend our heartfelt gratitude to all the amazing contributors who have made
CHIKATLA RAKESH
|
-
-
|