diff --git a/services/ui-src/src/containers/PackageList.js b/services/ui-src/src/containers/PackageList.js
index fc23ff21d..0c7a377e4 100644
--- a/services/ui-src/src/containers/PackageList.js
+++ b/services/ui-src/src/containers/PackageList.js
@@ -218,7 +218,7 @@ const PackageList = () => {
({ value, row }) => (
{value}
diff --git a/services/ui-src/src/containers/UserManagement.js b/services/ui-src/src/containers/UserManagement.js
index 328e63ca7..1cba6f28b 100644
--- a/services/ui-src/src/containers/UserManagement.js
+++ b/services/ui-src/src/containers/UserManagement.js
@@ -166,7 +166,7 @@ const UserManagement = () => {
({ value, row }) => (
{value}
diff --git a/services/ui-src/src/containers/UserPage.js b/services/ui-src/src/containers/UserPage.js
index fff126682..011497c34 100644
--- a/services/ui-src/src/containers/UserPage.js
+++ b/services/ui-src/src/containers/UserPage.js
@@ -1,5 +1,5 @@
import React, { useCallback, useEffect, useMemo, useState } from "react";
-import { useLocation, useParams } from "react-router-dom";
+import { useLocation, useParams, useHistory } from "react-router-dom";
import { Button, Review } from "@cmsgov/design-system";
import {
@@ -157,6 +157,7 @@ export const GroupDivisionDisplay = ({ profileData = {} }) => {
* Component housing data belonging to a particular user
*/
const UserPage = () => {
+ const history = useHistory();
const { userProfile, setUserInfo, updatePhoneNumber, userRole, userStatus } =
useAppContext();
const location = useLocation();
@@ -174,10 +175,10 @@ const UserPage = () => {
const [isEditingPhone, setIsEditingPhone] = useState(false);
const isReadOnly =
location.pathname !== ROUTES.PROFILE &&
- decodeURIComponent(userId) !== userProfile.email;
+ decodeURIComponent(userId) !== window.btoa(userProfile.email);
useEffect(() => {
- const getProfile = async (profileEmail) => {
+ const getProfile = async (encodedProfileEmail) => {
if (!isReadOnly) {
return [{ ...userProfile.userData }, userRole, userStatus];
}
@@ -187,6 +188,7 @@ const UserPage = () => {
tempProfileStatus = "status";
try {
+ const profileEmail = window.atob(encodedProfileEmail);
tempProfileData = await UserDataApi.userProfile(profileEmail);
const profileAccess = effectiveRoleForUser(tempProfileData?.roleList);
if (profileAccess !== null)
@@ -194,6 +196,8 @@ const UserPage = () => {
} catch (e) {
console.error("Error fetching user data", e);
setAlertCode(RESPONSE_CODE[e.message]);
+ // redirect if the user is not found
+ history.push("/notfound");
}
return [tempProfileData, tempProfileRole, tempProfileStatus];
@@ -209,7 +213,7 @@ const UserPage = () => {
console.error("Error fetching user data", e);
setAlertCode(RESPONSE_CODE[e.message]);
});
- }, [isReadOnly, userId, userProfile, userRole, userStatus]);
+ }, [isReadOnly, userId, userProfile, userRole, userStatus, history]);
const onPhoneNumberCancel = useCallback(() => {
setIsEditingPhone(false);