Merge pull request #10543 from f321x/qml_trustedcoin

qml: make 2fa secret copyable, open 2fa app for user
This commit is contained in:
ThomasV
2026-03-25 08:36:32 +01:00
committed by GitHub
2 changed files with 36 additions and 6 deletions
@@ -8,6 +8,8 @@ Item {
property bool enableToggleText: false // if true, clicking the QR code shows the encoded text
property bool isTextState: false // internal state, if the above is enabled
signal clicked()
property var _qrprops: QRIP.getDimensions(qrdata)
width: r.width
@@ -71,6 +73,8 @@ Item {
onClicked: {
if (enableToggleText) {
root.isTextState = !root.isTextState
} else {
root.clicked()
}
}
}
@@ -40,23 +40,45 @@ WizardComponent {
qrdata: encodeURI('otpauth://totp/Electrum 2FA ' + wizard_data['wallet_name']
+ '?secret=' + plugin.otpSecret + '&digits=6')
render: plugin.otpSecret
onClicked: {
if (plugin.otpSecret) {
if (AppController.isAndroid()) {
Qt.openUrlExternally(qrdata)
} else {
AppController.textToClipboard(plugin.otpSecret)
toaster.show(this, qsTr('Copied!'))
}
}
}
}
TextHighlightPane {
Item {
Layout.alignment: Qt.AlignHCenter
visible: plugin.otpSecret
implicitWidth: otpSecretPane.implicitWidth
implicitHeight: otpSecretPane.implicitHeight
TextHighlightPane {
id: otpSecretPane
Label {
text: plugin.otpSecret
font.family: FixedFont
font.bold: true
}
}
MouseArea {
anchors.fill: parent
onClicked: {
AppController.textToClipboard(plugin.otpSecret)
toaster.show(otpSecretPane, qsTr('Copied!'))
}
}
}
Label {
Layout.fillWidth: true
visible: !otpVerified && plugin.otpSecret
wrapMode: Text.Wrap
text: qsTr('Enter or scan into authenticator app. Then authenticate below')
text: qsTr('Tap the QR code to open in your authenticator app, or scan it manually. Then authenticate below')
}
Label {
@@ -118,6 +140,10 @@ WizardComponent {
otp_auth.forceActiveFocus()
}
Toaster {
id: toaster
}
Connections {
target: plugin
function onOtpError(message) {