From d6ce6a1afdbfc538878852fa949fb6a836aa0d71 Mon Sep 17 00:00:00 2001 From: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com> Date: Fri, 19 Jan 2024 15:06:54 +0000 Subject: [PATCH] Improve TOTP modal (#2327) * Improve TOTP modal * Add submit translation * Update translations --------- Co-authored-by: SleeplessOne1917 --- lemmy-translations | 2 +- src/shared/components/common/totp-modal.tsx | 15 ++++++++++++++- src/shared/components/search.tsx | 4 ++-- src/shared/services/HttpService.ts | 21 +++------------------ 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/lemmy-translations b/lemmy-translations index 21b8e8d9..6fe83fe9 160000 --- a/lemmy-translations +++ b/lemmy-translations @@ -1 +1 @@ -Subproject commit 21b8e8d9d380bef6c39b6b06fc9563d3fedf2ab6 +Subproject commit 6fe83fe9c0bfdf8bcee6e2528e4420fabd582b8b diff --git a/src/shared/components/common/totp-modal.tsx b/src/shared/components/common/totp-modal.tsx index b07b4b86..8a9eabc3 100644 --- a/src/shared/components/common/totp-modal.tsx +++ b/src/shared/components/common/totp-modal.tsx @@ -21,12 +21,15 @@ interface TotpModalProps { interface TotpModalState { totp: string; qrCode?: string; + pending: boolean; } const TOTP_LENGTH = 6; async function handleSubmit(i: TotpModal, totp: string) { + i.setState({ pending: true }); const successful = await i.props.onSubmit(totp); + i.setState({ pending: false }); if (!successful) { i.setState({ totp: "" }); @@ -74,6 +77,7 @@ export default class TotpModal extends Component< modal: Modal; state: TotpModalState = { totp: "", + pending: false, }; constructor(props: TotpModalProps, context: any) { @@ -131,7 +135,7 @@ export default class TotpModal extends Component< render() { const { type, secretUrl, onClose } = this.props; - const { totp } = this.state; + const { totp, pending } = this.state; return (