Skip to content

Commit a62b951

Browse files
feat(@desktop/biometric): wait for biometrics confirmation to complete before landing on homepage
fixes #19013
1 parent c207b46 commit a62b951

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

ui/main.qml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ StatusWindow {
4747
readonly property UtilsStore utilsStore: UtilsStore {}
4848
readonly property LanguageStore languageStore: LanguageStore {}
4949
readonly property bool appThemeDark: Theme.isDarkTheme
50+
property bool biometricFlowPending: false
5051

5152
objectName: "mainWindow"
5253
color: Theme.palette.background
@@ -442,8 +443,23 @@ StatusWindow {
442443
// These signal handlers keep the compatibility with the old keychain approach,
443444
// which is used by `keycard_popup` (any auth inside the app) and the old onboarding.
444445
// NOTE: this hack won't work if changes are made with another Keychain instance.
445-
onCredentialSaved: (account) => localAccountSettings.storeToKeychainValue = Constants.keychain.storedValue.store
446+
onCredentialSaved: function (account) {
447+
applicationWindow.biometricFlowPending = false
448+
// load appMain if not already after biometric flow is complete
449+
if(loader.sourceComponent !== app && applicationWindow.appIsReady) {
450+
moveToAppMain()
451+
}
452+
localAccountSettings.storeToKeychainValue = Constants.keychain.storedValue.store
453+
}
446454
onCredentialDeleted: (account) => localAccountSettings.storeToKeychainValue = Constants.keychain.storedValue.never
455+
onGetCredentialRequestCompleted: function(status, secret) {
456+
// Handle Failure to safely move on to appMain
457+
if (status !== Keychain.StatusSuccess &&
458+
loader.sourceComponent !== app &&
459+
applicationWindow.appIsReady) {
460+
moveToAppMain()
461+
}
462+
}
447463
}
448464

449465
Component {
@@ -464,12 +480,17 @@ StatusWindow {
464480
onAppLoaded: {
465481
applicationWindow.appIsReady = true
466482
applicationWindow.storeAppState()
467-
moveToAppMain()
483+
484+
// only load appMain if biometrics flow is complete
485+
if(!applicationWindow.biometricFlowPending) {
486+
moveToAppMain()
487+
}
468488
}
469489
onAccountLoginError: function (error, wrongPassword) {
470490
onboardingLayout.unwindToLoginScreen() // error handled internally
471491
}
472492
onSaveBiometricsRequested: (account, credential) => {
493+
applicationWindow.biometricFlowPending = true
473494
appKeychain.saveCredential(account, credential)
474495
}
475496
onDeleteBiometricsRequested: (account) => {

0 commit comments

Comments
 (0)