From 8132de764d518c8c4bd667d192814d5cda81ce7b Mon Sep 17 00:00:00 2001 From: ChaotiCryptidz Date: Sat, 22 Jan 2022 11:56:00 +0000 Subject: [PATCH] make TOTPNew page hide input boxes in QR mode --- src/ui/pages/Secrets/TOTP/TOTPNew.tsx | 54 +++++++++++++++------------ 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/src/ui/pages/Secrets/TOTP/TOTPNew.tsx b/src/ui/pages/Secrets/TOTP/TOTPNew.tsx index 724032c..f80baf6 100644 --- a/src/ui/pages/Secrets/TOTP/TOTPNew.tsx +++ b/src/ui/pages/Secrets/TOTP/TOTPNew.tsx @@ -32,7 +32,7 @@ export class TOTPNewForm extends Component< } errorMessageRef = createRef(); - uriInputRef = createRef(); + nameInputRef = createRef(); async onSubmit(data: FormData): Promise { const parms = { @@ -56,6 +56,7 @@ export class TOTPNewForm extends Component<
this.onSubmit(data)}> - + {!this.state.qrMode &&

{i18next.t("totp_new_info")}

} - - - + {!this.state.qrMode && ( + <> + + + - - - - - {/* TODO: please redo this to be more like Unseal page qr mode */} + + + + + )} {this.state.qrMode && ( { - this.uriInputRef.current.value = uri; + let formData = new FormData(); + formData.set("key", ""); + formData.set("name", this.nameInputRef.current.value) + formData.set("uri", uri); + this.onSubmit(formData); this.setState({ qrMode: !this.state.qrMode }); }} />