Modal.mount(),
+ return (
+
+ Modal.mount(
+ ,
+ ),
+ },
+ {
+ text: t("NEXT"),
+ onClick: () => {
+ acquisitionSession.setLoginDetail("otpToken", otp);
+ acquisitionSession.attemptLogin();
},
- {
- text: this.props.t("NEXT"),
- onClick: () => {
- UserManager.setLoginDetail(
- "otpToken",
- this.state.otp,
- );
- UserManager.attemptLogin();
- },
- },
- ]}
- >
-
-
-
- {this.props.t(
- "LOG_IN_TWO_FACTOR_AUTHENTICATION_PROMPT_1",
- )}
-
-
- {this.props.t(
- "LOG_IN_TWO_FACTOR_AUTHENTICATION_PROMPT_2",
- )}
-
-
-
-
-
-
- );
- }
+ },
+ ]}
+ >
+
+
+
+ {t("LOG_IN_TWO_FACTOR_AUTHENTICATION_PROMPT_1")}
+
+
+ {t("LOG_IN_TWO_FACTOR_AUTHENTICATION_PROMPT_2")}
+
+
+
+ setOtp((e.target as HTMLInputElement).value)
+ }
+ />
+
+
+
+ );
}
-
-export const LoginOtpModal = withTranslation()(LoginOtpModalComponent);
diff --git a/Parlance.ClientApp/src/components/modals/account/LoginPasswordModal.tsx b/Parlance.ClientApp/src/components/modals/account/LoginPasswordModal.tsx
index f0ab8294..ad78b6a0 100644
--- a/Parlance.ClientApp/src/components/modals/account/LoginPasswordModal.tsx
+++ b/Parlance.ClientApp/src/components/modals/account/LoginPasswordModal.tsx
@@ -6,18 +6,17 @@ import { useTranslation } from "react-i18next";
import LineEdit from "../../LineEdit";
import ModalList from "../../ModalList";
import { VerticalSpacer } from "@/components/Layouts";
+import { TokenAcquisitionSession } from "@/helpers/TokenAcquisitionSession";
-export function LoginPasswordModal() {
- const [password, setPassword] = useState(
- UserManager.loginDetail("prePassword"),
- );
+export function LoginPasswordModal({
+ acquisitionSession,
+}: {
+ acquisitionSession: TokenAcquisitionSession;
+}) {
+ const [password, setPassword] = useState(acquisitionSession.prePassword);
const { t } = useTranslation();
- useEffect(() => {
- UserManager.setLoginDetail("prePassword");
- }, []);
-
- const loginTypes = UserManager.loginTypes!.map(type => {
+ const loginTypes = acquisitionSession.loginTypes.map(type => {
switch (type) {
case "password":
return (
@@ -48,7 +47,8 @@ export function LoginPasswordModal() {
{[
{
text: t("LOG_IN_USE_SECURITY_KEY_PROMPT"),
- onClick: () => UserManager.attemptFido2Login(),
+ onClick: () =>
+ acquisitionSession.attemptFido2Login(),
},
]}
@@ -59,23 +59,23 @@ export function LoginPasswordModal() {
return (