fix(BiometricLogin): Move to regular login page when biometric login fails with error (#14860)

This commit is contained in:
Alex Jbanca 2024-05-21 18:42:53 +03:00 committed by GitHub
parent 55edd94401
commit f944e8359b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 21 additions and 10 deletions

View File

@ -61,7 +61,7 @@ Item {
QtObject { QtObject {
id: d id: d
property bool loading: false property bool loading: false
readonly property bool isBiometricsLogin: localAccountSettings.storeToKeychainValue === Constants.keychain.storedValue.store
readonly property string stateLoginRegularUser: "regularUserLogin" readonly property string stateLoginRegularUser: "regularUserLogin"
readonly property string stateLoginKeycardUser: "keycardUserLogin" readonly property string stateLoginKeycardUser: "keycardUserLogin"
readonly property bool isRegularLogin: (image.source.toString() === Style.png("status-logo")) readonly property bool isRegularLogin: (image.source.toString() === Style.png("status-logo"))
@ -93,7 +93,7 @@ Item {
} }
function resetLogin() { function resetLogin() {
if(localAccountSettings.storeToKeychainValue !== Constants.keychain.storedValue.store) if(!d.isBiometricsLogin)
{ {
if (!root.startupStore.selectedLoginAccount.keycardCreatedAccount){ if (!root.startupStore.selectedLoginAccount.keycardCreatedAccount){
txtPassword.visible = true txtPassword.visible = true
@ -124,7 +124,7 @@ Item {
} }
function onObtainingPasswordSuccess(password: string) { function onObtainingPasswordSuccess(password: string) {
if(localAccountSettings.storeToKeychainValue !== Constants.keychain.storedValue.store) if(!d.isBiometricsLogin)
return return
if (root.startupStore.selectedLoginAccount.keycardCreatedAccount) { if (root.startupStore.selectedLoginAccount.keycardCreatedAccount) {
@ -145,6 +145,11 @@ Item {
txtPassword.validationError = qsTr("Login failed: %1").arg(error.toUpperCase()) txtPassword.validationError = qsTr("Login failed: %1").arg(error.toUpperCase())
} }
d.loading = false d.loading = false
// Activate the link to switch to password login
if (d.isBiometricsLogin)
link.activate()
txtPassword.textField.forceActiveFocus() txtPassword.textField.forceActiveFocus()
} }
} }
@ -501,9 +506,15 @@ Item {
StatusBaseText { StatusBaseText {
id: link id: link
function activate() {
root.startupStore.doSecondaryAction()
}
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
color: Theme.palette.primaryColor1 color: Theme.palette.primaryColor1
font.pixelSize: Constants.keycard.general.fontSize2 font.pixelSize: Constants.keycard.general.fontSize2
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
@ -515,7 +526,7 @@ Item {
parent.font.underline = false parent.font.underline = false
} }
onClicked: { onClicked: {
root.startupStore.doSecondaryAction() link.activate()
} }
} }
} }
@ -529,24 +540,24 @@ Item {
root.startupStore.currentStartupState.stateType === Constants.startupState.login root.startupStore.currentStartupState.stateType === Constants.startupState.login
PropertyChanges { PropertyChanges {
target: image target: image
source: localAccountSettings.storeToKeychainValue === Constants.keychain.storedValue.store? source: d.isBiometricsLogin ?
Style.png("keycard/biometrics-success") : Style.png("status-logo") Style.png("keycard/biometrics-success") : Style.png("status-logo")
pattern: "" pattern: ""
Layout.preferredHeight: localAccountSettings.storeToKeychainValue === Constants.keychain.storedValue.store? Layout.preferredHeight: d.isBiometricsLogin ?
Constants.onboarding.biometricsImageWidth : Constants.onboarding.biometricsImageWidth :
Constants.onboarding.logoImageHeight Constants.onboarding.logoImageHeight
Layout.preferredWidth: localAccountSettings.storeToKeychainValue === Constants.keychain.storedValue.store? Layout.preferredWidth: d.isBiometricsLogin ?
Constants.onboarding.biometricsImageHeight : Constants.onboarding.biometricsImageHeight :
Constants.onboarding.logoImageWidth Constants.onboarding.logoImageWidth
} }
PropertyChanges { PropertyChanges {
target: title target: title
text: localAccountSettings.storeToKeychainValue === Constants.keychain.storedValue.store? "" : qsTr("Welcome back") text: d.isBiometricsLogin ? "" : qsTr("Welcome back")
visible: localAccountSettings.storeToKeychainValue !== Constants.keychain.storedValue.store visible: !d.isBiometricsLogin
} }
PropertyChanges { PropertyChanges {
target: passwordSection target: passwordSection
visible: localAccountSettings.storeToKeychainValue !== Constants.keychain.storedValue.store visible: !d.isBiometricsLogin
} }
PropertyChanges { PropertyChanges {
target: pinSection target: pinSection