diff --git a/frontend/pages/hosts/details/DeviceUserPage/DeviceUserPage.tsx b/frontend/pages/hosts/details/DeviceUserPage/DeviceUserPage.tsx
index d40570aead..10a5d5332b 100644
--- a/frontend/pages/hosts/details/DeviceUserPage/DeviceUserPage.tsx
+++ b/frontend/pages/hosts/details/DeviceUserPage/DeviceUserPage.tsx
@@ -416,7 +416,10 @@ const DeviceUserPage = ({
{showInfoModal && }
{showEnrollMdmModal && renderEnrollMdmModal()}
{showResetKeyModal && (
-
+
)}
)}
diff --git a/frontend/pages/hosts/details/DeviceUserPage/ResetKeyModal/ResetKeyModal.tsx b/frontend/pages/hosts/details/DeviceUserPage/ResetKeyModal/ResetKeyModal.tsx
index 54267f859f..e8ba73a4b3 100644
--- a/frontend/pages/hosts/details/DeviceUserPage/ResetKeyModal/ResetKeyModal.tsx
+++ b/frontend/pages/hosts/details/DeviceUserPage/ResetKeyModal/ResetKeyModal.tsx
@@ -1,45 +1,45 @@
-import React, { useState } from "react";
+import React from "react";
import Button from "components/buttons/Button";
import Modal from "components/Modal";
+import mdmAPI from "services/entities/mdm";
+import { useQuery } from "react-query";
+import Spinner from "components/Spinner";
+import DataError from "components/DataError";
interface IResetKeyModalProps {
- onCancel: () => void;
+ onClose: () => void;
+ deviceAuthToken: string;
}
const baseClass = "reset-key-modal";
-const ResetKeyModal = ({ onCancel }: IResetKeyModalProps): JSX.Element => {
- const [success, setSuccess] = useState(false);
- const [isLoading, setIsLoading] = useState(false);
+const ResetKeyModal = ({
+ onClose,
+ deviceAuthToken,
+}: IResetKeyModalProps): JSX.Element => {
+ const { isLoading: isLoadingResetDEKey, error: errorResetDEKey } = useQuery(
+ ["resetDEkey"],
+ () => mdmAPI.resetEncryptionKey(deviceAuthToken)
+ );
- // TODO: actually make this work: https://www.figma.com/file/hdALBDsrti77QuDNSzLdkx/%F0%9F%9A%A7-Fleet-EE-(dev-ready%2C-scratchpad)?node-id=11728%3A323033&t=GbmGwTkgjENhmJmO-1
- const startNativeKeyReset = () => {
- setIsLoading(true);
- setTimeout(() => {
- setSuccess(true);
- }, 1000);
- };
+ const renderModalBody = () => {
+ if (isLoadingResetDEKey) {
+ return ;
+ }
+ if (errorResetDEKey) {
+ return ;
+ }
- return (
-
+ return (
- Click Start and enter your username and password.
- {success ? (
- Success!
- ) : (
-
- Start
-
- )}
+ Wait 30 seconds for the Reset disk encryption key pop up to
+ open.
+
+
+ In the popup, enter the password you use to login to your Mac.
Close this window and select Refetch on your My device page.
@@ -47,11 +47,16 @@ const ResetKeyModal = ({ onCancel }: IResetKeyModalProps): JSX.Element => {
-
+
Done
+ );
+ };
+ return (
+
+ {renderModalBody()}
);
};
diff --git a/frontend/pages/hosts/details/DeviceUserPage/ResetKeyModal/_styles.scss b/frontend/pages/hosts/details/DeviceUserPage/ResetKeyModal/_styles.scss
index ad4bd9933b..f40c1f1c1d 100644
--- a/frontend/pages/hosts/details/DeviceUserPage/ResetKeyModal/_styles.scss
+++ b/frontend/pages/hosts/details/DeviceUserPage/ResetKeyModal/_styles.scss
@@ -1,14 +1,4 @@
.reset-key-modal {
- &__start-button {
- margin-top: 12px;
- }
-
- &__success {
- margin-top: 12px;
- padding: $pad-small;
- height: 22px;
- }
-
ol {
padding-left: 0;
}
diff --git a/frontend/services/entities/mdm.ts b/frontend/services/entities/mdm.ts
index 857836e4d8..bc9ca14829 100644
--- a/frontend/services/entities/mdm.ts
+++ b/frontend/services/entities/mdm.ts
@@ -8,6 +8,10 @@ export default {
const { DEVICE_USER_MDM_ENROLLMENT_PROFILE } = endpoints;
return sendRequest("GET", DEVICE_USER_MDM_ENROLLMENT_PROFILE(token));
},
+ resetEncryptionKey: (token: string) => {
+ const { DEVICE_USER_RESET_ENCRYPTION_KEY } = endpoints;
+ return sendRequest("POST", DEVICE_USER_RESET_ENCRYPTION_KEY(token));
+ },
unenrollHostFromMdm: (hostId: number, timeout?: number) => {
const { HOST_MDM_UNENROLL } = endpoints;
return sendRequest(
diff --git a/frontend/utilities/endpoints.ts b/frontend/utilities/endpoints.ts
index bd9bfda7a9..39a88fab5f 100644
--- a/frontend/utilities/endpoints.ts
+++ b/frontend/utilities/endpoints.ts
@@ -11,6 +11,9 @@ export default {
DEVICE_USER_MDM_ENROLLMENT_PROFILE: (token: string): string => {
return `/${API_VERSION}/fleet/device/${token}/mdm/apple/manual_enrollment_profile`;
},
+ DEVICE_USER_RESET_ENCRYPTION_KEY: (token: string): string => {
+ return `/${API_VERSION}/fleet/device/${token}/rotate_encryption_key`;
+ },
DOWNLOAD_INSTALLER: `/${API_VERSION}/fleet/download_installer`,
ENABLE_USER: (id: number): string => {
return `/${API_VERSION}/fleet/users/${id}/enable`;