fix(@desktop/general): authenticate with previously stored pass/pin to a Keychain issue fixed

This commit is contained in:
Sale Djenic 2023-04-03 15:29:14 +02:00 committed by saledjenic
parent 3c5c52b138
commit 6885fda217
3 changed files with 30 additions and 6 deletions

View File

@ -26,4 +26,27 @@ method executeCancelCommand*(self: BiometricsReadyToSignState, controller: Contr
method resolveKeycardNextState*(self: BiometricsReadyToSignState, keycardFlowType: string, keycardEvent: KeycardEvent,
controller: Controller): State =
return ensureReaderAndCardPresenceAndResolveNextState(self, keycardFlowType, keycardEvent, controller)
let state = ensureReaderAndCardPresence(self, keycardFlowType, keycardEvent, controller)
if not state.isNil:
return state
if self.flowType == FlowType.Authentication:
if keycardFlowType == ResponseTypeValueEnterPIN and
keycardEvent.error.len > 0 and
keycardEvent.error == ErrorPIN:
controller.setRemainingAttempts(keycardEvent.pinRetries)
if keycardEvent.pinRetries > 0:
if singletonInstance.userProfile.getUsingBiometricLogin() and not controller.usePinFromBiometrics():
return createState(StateType.WrongKeychainPin, self.flowType, nil)
return createState(StateType.WrongPin, self.flowType, nil)
return createState(StateType.MaxPinRetriesReached, self.flowType, nil)
if keycardFlowType == ResponseTypeValueEnterPIN and
keycardEvent.error.len == 0:
return createState(StateType.MaxPinRetriesReached, self.flowType, nil)
if keycardFlowType == ResponseTypeValueEnterPUK and
keycardEvent.error.len == 0:
if keycardEvent.pinRetries == 0 and keycardEvent.pukRetries > 0:
return createState(StateType.MaxPinRetriesReached, self.flowType, nil)
if keycardFlowType == ResponseTypeValueKeycardFlowResult:
if keycardEvent.error.len == 0:
controller.terminateCurrentFlow(lastStepInTheCurrentFlow = true)
return nil

View File

@ -454,14 +454,14 @@ method runFlow*[T](self: Module[T], flowToRun: FlowType, keyUid = "", bip44Path
if flowToRun == FlowType.Authentication:
self.controller.connectKeychainSignals()
if keyUid.len == 0 or keyUid == singletonInstance.userProfile.getKeyUid():
if singletonInstance.userProfile.getUsingBiometricLogin():
self.controller.tryToObtainDataFromKeychain()
return
if singletonInstance.userProfile.getIsKeycardUser():
self.prepareKeyPairItemForAuthentication(singletonInstance.userProfile.getKeyUid())
self.tmpLocalState = newReadingKeycardState(flowToRun, nil)
self.controller.runAuthenticationFlow(singletonInstance.userProfile.getKeyUid())
return
if singletonInstance.userProfile.getUsingBiometricLogin():
self.controller.tryToObtainDataFromKeychain()
return
self.view.setCurrentState(newEnterPasswordState(flowToRun, nil))
self.authenticationPopupIsAlreadyRunning = true
self.controller.readyToDisplayPopup()
@ -629,6 +629,7 @@ method keychainObtainedDataSuccess*[T](self: Module[T], data: string) =
return
if not currStateObj.isNil:
if data.len == PINLengthForStatusApp:
self.controller.setPin(data)
self.controller.enterKeycardPin(data)
else:
self.view.setCurrentState(newBiometricsPinInvalidState(FlowType.Authentication, nil))

View File

@ -169,7 +169,7 @@ Item {
}
PropertyChanges {
target: title
text: qsTr("Password changed on other device")
text: qsTr("Stored password doesn't match")
font.pixelSize: Constants.keycard.general.fontSize1
color: Theme.palette.directColor1
}
@ -194,7 +194,7 @@ Item {
}
PropertyChanges {
target: title
text: qsTr("Password changed on other device")
text: qsTr("Stored password doesn't match")
font.pixelSize: Constants.keycard.general.fontSize1
color: Theme.palette.directColor1
}