feat(@desktop/keycard): login flow wrong keychain pin update

This commit is contained in:
Sale Djenic 2022-09-26 11:31:32 +02:00 committed by saledjenic
parent 861c585d2b
commit 08ef68706f
8 changed files with 15 additions and 9 deletions

View File

@ -16,7 +16,7 @@ method executePrimaryCommand*(self: LoginKeycardInsertKeycardState, controller:
controller.enterKeycardPin(controller.getPin())
method getNextPrimaryState*(self: LoginKeycardInsertKeycardState, controller: Controller): State =
if controller.keychainErrorOccurred():
if controller.keychainErrorOccurred() or controller.getPin().len != PINLengthForStatusApp:
return createState(StateType.LoginKeycardEnterPin, self.flowType, nil)
method getNextSecondaryState*(self: LoginKeycardInsertKeycardState, controller: Controller): State =

View File

@ -18,7 +18,7 @@ method executePrimaryCommand*(self: LoginKeycardReadingKeycardState, controller:
controller.enterKeycardPin(controller.getPin())
method getNextPrimaryState*(self: LoginKeycardReadingKeycardState, controller: Controller): State =
if controller.keychainErrorOccurred():
if controller.keychainErrorOccurred() or controller.getPin().len != PINLengthForStatusApp:
return createState(StateType.LoginKeycardEnterPin, self.flowType, nil)
method getNextSecondaryState*(self: LoginKeycardReadingKeycardState, controller: Controller): State =

View File

@ -16,7 +16,7 @@ method executePrimaryCommand*(self: LoginKeycardWrongKeycardState, controller: C
controller.enterKeycardPin(controller.getPin())
method getNextPrimaryState*(self: LoginKeycardWrongKeycardState, controller: Controller): State =
if controller.keychainErrorOccurred():
if controller.keychainErrorOccurred() or controller.getPin().len != PINLengthForStatusApp:
return createState(StateType.LoginKeycardEnterPin, self.flowType, nil)
method getNextSecondaryState*(self: LoginKeycardWrongKeycardState, controller: Controller): State =

View File

@ -18,7 +18,7 @@ method executePrimaryCommand*(self: LoginKeycardWrongPinState, controller: Contr
controller.enterKeycardPin(controller.getPin())
method getNextPrimaryState*(self: LoginKeycardWrongPinState, controller: Controller): State =
if controller.keychainErrorOccurred():
if controller.keychainErrorOccurred() or controller.getPin().len != PINLengthForStatusApp:
return createState(StateType.LoginKeycardEnterPin, self.flowType, nil)
method getNextSecondaryState*(self: LoginKeycardWrongPinState, controller: Controller): State =

View File

@ -16,7 +16,7 @@ method executePrimaryCommand*(self: LoginPluginState, controller: Controller) =
controller.enterKeycardPin(controller.getPin())
method getNextPrimaryState*(self: LoginPluginState, controller: Controller): State =
if controller.keychainErrorOccurred():
if controller.keychainErrorOccurred() or controller.getPin().len != PINLengthForStatusApp:
return createState(StateType.LoginKeycardEnterPin, self.flowType, nil)
method getNextSecondaryState*(self: LoginPluginState, controller: Controller): State =

View File

@ -16,7 +16,7 @@ method executePrimaryCommand*(self: LoginState, controller: Controller) =
controller.enterKeycardPin(controller.getPin())
method getNextPrimaryState*(self: LoginState, controller: Controller): State =
if controller.keychainErrorOccurred():
if controller.keychainErrorOccurred() or controller.getPin().len != PINLengthForStatusApp:
return createState(StateType.LoginKeycardEnterPin, self.flowType, nil)
method getNextSecondaryState*(self: LoginState, controller: Controller): State =

View File

@ -271,8 +271,8 @@ proc ensureReaderAndCardPresenceAndResolveNextLoginState*(state: State, keycardF
controller.setKeycardEvent(keycardEvent)
controller.loginAccountKeycard()
return nil
if keycardFlowType == ResponseTypeValueEnterPIN and
keycardEvent.error.len == 0:
if keycardFlowType == ResponseTypeValueEnterPIN:
if keycardEvent.error.len == 0:
if not controller.keyUidMatch(keycardEvent.keyUid):
return createState(StateType.LoginKeycardWrongKeycard, state.flowType, nil)
let value = singletonInstance.localAccountSettings.getStoreToKeychainValue()
@ -280,6 +280,12 @@ proc ensureReaderAndCardPresenceAndResolveNextLoginState*(state: State, keycardF
controller.tryToObtainDataFromKeychain()
return nil
return createState(StateType.LoginKeycardEnterPin, state.flowType, nil)
if keycardEvent.error.len > 0:
if keycardEvent.error == RequestParamPIN:
controller.setKeycardData($keycardEvent.pinRetries)
if keycardEvent.pinRetries > 0:
return createState(StateType.LoginKeycardWrongPin, state.flowType, nil)
return createState(StateType.LoginKeycardMaxPinRetriesReached, state.flowType, nil)
if keycardFlowType == ResponseTypeValueEnterPUK and
keycardEvent.error.len == 0:
if keycardEvent.pinRetries == 0 and keycardEvent.pukRetries > 0:

View File

@ -35,6 +35,7 @@ Item {
}
onStateChanged: {
d.loading = false
pinInputField.statesInitialization()
pinInputField.forceFocus()
}
@ -424,7 +425,6 @@ Item {
StatusButton {
id: button
Layout.alignment: Qt.AlignHCenter
focus: true
onClicked: {
root.startupStore.doPrimaryAction()
}