Skip to content

Commit 204e82c

Browse files
Merge branch 'thapar'
2 parents 1b62ae3 + 2c3bb90 commit 204e82c

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

backend/controllers/user.controller.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@ export const claimItem = async (req, res) => {
4141
});
4242

4343
if (rejectedClaim) {
44-
return res
45-
.status(403)
46-
.json({
47-
message:
48-
"You cannot claim this item as your previous claim was rejected",
49-
});
44+
return res.status(403).json({
45+
message:
46+
"You cannot claim this item as your previous claim was rejected",
47+
});
5048
}
5149

5250
// Create new claim
@@ -431,10 +429,12 @@ export const updateProfile = async (req, res) => {
431429
const schema = Joi.object({
432430
// Limit name length to reasonable size
433431
name: Joi.string().min(2).max(100),
434-
// Require numeric roll numbers (accept number or numeric string)
432+
// Accept only numeric roll numbers for updates (6-15 digits)
435433
rollNo: Joi.alternatives().try(
436-
Joi.number().integer().min(1),
437-
Joi.string().pattern(/^\d+$/),
434+
Joi.number().integer().min(100000).max(999999999999999),
435+
Joi.string()
436+
.pattern(/^\d{6,15}$/)
437+
.message("Roll number must be 6-15 digits"),
438438
),
439439
phone: Joi.string()
440440
.pattern(/^\d{10,15}$/)

frontend/src/pages/Profile.jsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ const Profile = () => {
590590
}`}>
591591
<div className="flex justify-between items-center">
592592
<p className={`text-sm ${darkMode ? 'text-yellow-200' : 'text-yellow-800'}`}>
593-
<strong>Next Steps:</strong> Visit the admin office during office hours for verification.
593+
<strong>Pending:</strong> Please visit the admin office during office hours to collect your item.
594594
</p>
595595
<button
596596
onClick={() => handleRemoveClaim(claim._id, claim.item?.name || 'this item')}
@@ -606,12 +606,22 @@ const Profile = () => {
606606
</div>
607607
)}
608608

609-
{claim.status === 'approved' && !claim.remarks && (
609+
{claim.status === 'approved' && (
610610
<div className={`p-4 rounded-lg border ${
611611
darkMode ? 'bg-green-900/20 border-green-800' : 'bg-green-50 border-green-200'
612612
}`}>
613613
<p className={`text-sm ${darkMode ? 'text-green-200' : 'text-green-800'}`}>
614-
<strong>Approved!</strong> Your claim has been approved. Please visit the admin office to collect your item.
614+
<strong>Approved!</strong> This item is now in your possession. You have successfully claimed this item.
615+
</p>
616+
</div>
617+
)}
618+
619+
{claim.status === 'rejected' && (
620+
<div className={`p-4 rounded-lg border ${
621+
darkMode ? 'bg-red-900/20 border-red-800' : 'bg-red-50 border-red-200'
622+
}`}>
623+
<p className={`text-sm ${darkMode ? 'text-red-200' : 'text-red-800'}`}>
624+
<strong>Rejected:</strong> Your claim was not approved.
615625
</p>
616626
</div>
617627
)}

0 commit comments

Comments
 (0)