diff --git a/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx b/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx
index 3b3b441ed..0ed08e037 100644
--- a/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/ReviewPoliciesScreen.tsx
@@ -1,13 +1,16 @@
import { AuthenticationProviderStatusOk } from "anastasis-core";
import { h, VNode } from "preact";
import { useState } from "preact/hooks";
+import { AsyncButton } from "../../components/AsyncButton";
import { useAnastasisContext } from "../../context/anastasis";
import { authMethods, KnownAuthMethods } from "./authMethod";
+import { ConfirmModal } from "./ConfirmModal";
import { EditPoliciesScreen } from "./EditPoliciesScreen";
import { AnastasisClientFrame } from "./index";
export function ReviewPoliciesScreen(): VNode {
const [editingPolicy, setEditingPolicy] = useState();
+ const [confirmReset, setConfirmReset] = useState(false);
const reducer = useAnastasisContext();
if (!reducer) {
return no reducer in context
;
@@ -23,8 +26,8 @@ export function ReviewPoliciesScreen(): VNode {
reducer.currentReducerState.authentication_methods ?? [];
const policies = reducer.currentReducerState.policies ?? [];
- const providers = reducer.currentReducerState.authentication_providers ?? {}
-
+ const providers = reducer.currentReducerState.authentication_providers ?? {};
+
if (editingPolicy !== undefined) {
return (
);
}
+ async function resetPolicies(): Promise {
+ if (!reducer) return Promise.resolve();
+ return reducer.runTransaction(async (tx) => {
+ await tx.transition("back", {});
+ await tx.transition("next", {});
+ setConfirmReset(false);
+ });
+ }
const errors = policies.length < 1 ? "Need more policies" : undefined;
return (
@@ -60,9 +71,13 @@ export function ReviewPoliciesScreen(): VNode {
methods.
)}
-
+
+
setConfirmReset(true)}>
+ Reset policies
+
);
})}
+ {confirmReset && (
+
setConfirmReset(false)}
+ description="Do you want to reset the policies to default state?"
+ label="Reset policies"
+ cancelLabel="Cancel"
+ onConfirm={resetPolicies}
+ >
+
+ All policies will be recalculated based on the authentication
+ providers configured and any change that you did will be lost
+
+
+ )}
);
}
diff --git a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx
index be8135ef5..3fe088c4f 100644
--- a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable @typescript-eslint/camelcase */
import { encodeCrock, stringToBytes } from "@gnu-taler/taler-util";
import { h, VNode } from "preact";
import { useState } from "preact/hooks";