From bf7b75e070769376b6a90a4f96e09ee6defb61e6 Mon Sep 17 00:00:00 2001 From: SleeplessOne1917 Date: Mon, 2 Oct 2023 22:47:07 -0400 Subject: [PATCH] Make inputs show up on totp modal --- src/shared/components/common/totp-modal.tsx | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/shared/components/common/totp-modal.tsx b/src/shared/components/common/totp-modal.tsx index a2030f84..642491c4 100644 --- a/src/shared/components/common/totp-modal.tsx +++ b/src/shared/components/common/totp-modal.tsx @@ -42,18 +42,28 @@ export default class TotpModal extends Component< constructor(props: TotpModalProps, context: any) { super(props, context); + + this.clearTotp = this.clearTotp.bind(this); } componentDidMount() { document .getElementById("totpModal") ?.addEventListener("shown.bs.modal", focusInput); + + document + .getElementById("totpModal") + ?.addEventListener("hidden.bs.modal", this.clearTotp); } componentWillUnmount() { document .getElementById("totpModal") ?.removeEventListener("shown.bs.modal", focusInput); + + document + .getElementById("totpModal") + ?.removeEventListener("hidden.bs.modal", this.clearTotp); } render() { @@ -96,8 +106,8 @@ export default class TotpModal extends Component< > Enter TOTP -
- {Array(6).map((_, i) => ( +
+ {Array.from(Array(TOTP_LENGTH).keys()).map(i => ( ))} @@ -130,4 +140,9 @@ export default class TotpModal extends Component<
); } + + clearTotp() { + console.log("clearing"); + this.setState({ totp: "" }); + } }