Skip to content

Passcode Change Controller

FUIPasscodeChangeController

public class FUIPasscodeChangeController: FUINavigationController

Use this UINavigationController to change the passcode screen flows in the application.

Set up the following properties before presenting this FUIPasscodeChangeController:

  • passcodeControllerDelegate: An implementation of FUIPasscodeControllerDelegate that handles events from this controller for both FUIPasscodeInputController and FUIPasscodeCreateController.
  • validationDelegate: An implementation of FUIPasscodeValidationDelegate that validates the passcode entered by the user.

Note that the properties hashUserPasscode and userIdentifier need to be the same as the FUIPasscodeCreateController in order for the change to be successful.

Here is the screen flow:

  • The first screen prompts the user to enter the current passcode using FUIPasscodeInputController. This controller always uses the passcode for authentication only. Note: If Touch ID is enabled, there will be Touch ID authentication popup to prompt user authenticate with Touch ID. Once user enters fingerprint or device passcode, the stored passcode in the keychain is retrieved and the delegate's shouldTryPasscode is invoked to validate the old passcode. And a new passcode is generated and shouldTryPasscode is invoked again to validate the new passcode. The new passcode is then saved in the keychain without other user actions.

  • The second screen prompts the user to enter a new passcode, which is validated by the FUIPasscodePolicy. The FUIPasscodeControllerDelegate provided function validate of validationDelegate is invoked for additional validation. Upon validation success, the next screen displays.

  • The third screen prompts the user to enter the passcode again to verify the passcode entered in the second screen. After the setup is complete, the function shouldTryPasscode of the FUIPasscodeControllerDelegate is invoked. The delegate should either create a secure store with the passcode, or save the passcode in a secure manner. Note: Changing the passcode does not affect the existing Touch ID preferences. No additional screens display to enable touchID to change the passcode flow. If touchID was previously disabled before triggering the passcode change, touchID remains disabled. However, if touchID was previously enabled, the internal touchID-related data is automatically updated after the passcode is changed.

This passcode flow change is implemented in FUIPasscodeChangeController.storyboard. There are two ways to invoke it:

  • Use another storyboard and add a "Present Modally" segue to the FUIPasscodeChangeController storyboard in the SAPFiori framework bundle. The app developer must provide the required properties in the UIController's prepare for segue function:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
   let changeController = segue.destination as! FUIPasscodeChangeController
   changeController.passcodeControllerDelegate = passcodeControllerDelegate
   changeController.validationDelegate = validationDelegate
}
  • Programmatically load it:
   let changeController = FUIPasscodeChangeController.createInstanceFromStoryboard()
   changeController.passcodeControllerDelegate = passcodeControllerDelegate
   changeController.validationDelegate = validationDelegate
   self.present(changeController, animated: true, completion: nil)

Last update: December 8, 2020