diff --git a/ipi-survey-platform/src/components/layout/HeaderBar.jsx b/ipi-survey-platform/src/components/layout/HeaderBar.jsx
index 0fb5a3a..3c01e31 100644
--- a/ipi-survey-platform/src/components/layout/HeaderBar.jsx
+++ b/ipi-survey-platform/src/components/layout/HeaderBar.jsx
@@ -100,12 +100,16 @@ const HeaderBar = () => {
className={({ isActive, isPending }) => `inline-flex items-center gap-2 pb-1 border-b-2 ${
isActive
? 'text-[#92722A] font-medium border-[#92722A]'
- : (window.location.pathname === '/dashboard' || window.location.pathname === '/overview')
+ : (window.location.pathname === '/dashboard' ||
+ window.location.pathname === '/overview' ||
+ window.location.pathname.startsWith('/edit-profile'))
? 'text-gray-400 cursor-not-allowed'
: 'text-[#232528] hover:text-gray-900 border-transparent'
}`}
onClick={(e) => {
- if (window.location.pathname === '/dashboard' || window.location.pathname === '/overview') {
+ if (window.location.pathname === '/dashboard' ||
+ window.location.pathname === '/overview' ||
+ window.location.pathname.startsWith('/edit-profile')) {
e.preventDefault();
}
}}
@@ -115,7 +119,9 @@ const HeaderBar = () => {
Survey
>
diff --git a/ipi-survey-platform/src/pages/Admin/configuration/AdminUsers/EditUserModal.jsx b/ipi-survey-platform/src/pages/Admin/configuration/AdminUsers/EditUserModal.jsx
index 91c36bf..cddd23b 100644
--- a/ipi-survey-platform/src/pages/Admin/configuration/AdminUsers/EditUserModal.jsx
+++ b/ipi-survey-platform/src/pages/Admin/configuration/AdminUsers/EditUserModal.jsx
@@ -1,6 +1,27 @@
import React from "react";
-const EditUserModal = ({ formData, setFormData, onClose, onUpdate }) => {
+const EditUserModal = ({ formData, setFormData, onClose, onUpdate, showToast }) => {
+ const handleUpdate = (e) => {
+ e.preventDefault();
+
+ // Check if the deactivated user is the currently logged-in user
+ const currentUser = JSON.parse(sessionStorage.getItem('user_profile') || '{}');
+ const currentUserEmail = currentUser?.email?.toLowerCase()?.trim();
+ const updatedUserEmail = formData.email?.toLowerCase()?.trim();
+ const shouldLogout = currentUserEmail === updatedUserEmail && formData.status === "Inactive";
+ // Call the original onUpdate with an additional parameter
+ onUpdate(e, shouldLogout);
+
+ // If it's the current user being deactivated, show a warning and log out
+ if (shouldLogout) {
+ showToast('This account has been deactivated. You will be logged out.', 'warning');
+ setTimeout(() => {
+ sessionStorage.clear();
+ window.location.href = '/login';
+ }, 1500);
+ }
+ };
+
return (