aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/paths/instance/templates/qr/QrPage.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/templates/qr/QrPage.tsx')
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/templates/qr/QrPage.tsx14
1 files changed, 12 insertions, 2 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/templates/qr/QrPage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/templates/qr/QrPage.tsx
index 66ac72ff5..a6b616907 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/templates/qr/QrPage.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/templates/qr/QrPage.tsx
@@ -96,20 +96,30 @@ export function QrPage({ template, id: templateId, onBack }: Props): VNode {
: template.pos_algorithm === 2
? `otpauth://totp/${issuer}:${templateId}?secret=${template.pos_key}&issuer=${issuer}&algorithm=SHA1&digits=8&period=30`
: undefined;
+
+ const keySlice = template.pos_key?.substring(0, 4);
+
+ const oauthUriWithoutSecret = !template.pos_algorithm
+ ? undefined
+ : template.pos_algorithm === 1
+ ? `otpauth://totp/${issuer}:${templateId}?secret=${keySlice}...&issuer=${issuer}&algorithm=SHA1&digits=8&period=30`
+ : template.pos_algorithm === 2
+ ? `otpauth://totp/${issuer}:${templateId}?secret=${keySlice}...&issuer=${issuer}&algorithm=SHA1&digits=8&period=30`
+ : undefined;
return (
<div>
{oauthUri && (
<ConfirmModal
description="Setup TOTP"
active={setupTOTP}
- onConfirm={() => {
+ onCancel={() => {
setSetupTOTP(false);
}}
>
<p>Scan this qr code with your TOTP device</p>
<QR text={oauthUri} />
<pre style={{ textAlign: "center" }}>
- <a href={oauthUri}>{oauthUri}</a>
+ <a href={oauthUri}>{oauthUriWithoutSecret}</a>
</pre>
</ConfirmModal>
)}