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:

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)

  • Declaration

    Swift

    public weak var passcodeControllerDelegate: FUIPasscodeControllerDelegate?
  • An implementaiton of FUIPasscodeValidationDelegate passed to FUIPasscodeCreateController for additional passcode validations during passcode create/change

    Declaration

    Swift

    public weak var validationDelegate: FUIPasscodeValidationDelegate?
  • App may provide a custom background image to be displayed under the Touch ID authentication popup.

    Declaration

    Swift

    public var customBackgroundImage: UIImage?
  • This property indicates if the create passcode process includes a screen to enable TouchID or not. The default is true. Note that if there is no TouchID registered on the device, the enable TouchID screen will not be shown even if this property is true.

    Declaration

    Swift

    public var canEnableTouchID: Bool
  • This controller can create a hash of the user passcode to obfuscate the clear text user password. If enabled, the passcode given to shouldTryPasscode is derived from the user passcode. The default is false.

    Declaration

    Swift

    public var hashUserPasscode: Bool
  • An UUID type string to identify the user. This will be used as part of the name to store passcode related items in the keychain.

    Declaration

    Swift

    public var userIdentifier: String?
  • The keychain access group associated with this instance. When set, the passcode related items will be stored in the shared keychain.

    Declaration

    Swift

    public var keychainAccessGroup: String?
  • If this property is true, a Cancel bar button item will be shown. When that Cancel bar button item is tapped, the didCancelPasscodeEntry function of the delegate will be invoked. The default is true.

    Declaration

    Swift

    public var showsCancelBarItem: Bool
  • If this property is true, a “Reset Passcode” button will be displayed when user entered a wrong passcode. The default is true.

    Declaration

    Swift

    public var showsResetButton: Bool
  • If this property is true, user needs to input the passcode to authenticate even if Touch ID or Face ID is enabled. The default is false.

    Declaration

    Swift

    public var isRequiringAlphaNumericInput: Bool
  • An image view to be added to the passcode screens.

    This image view is to be displayed on the top center of passcode views and is typically the company logo image. Developer is expected to set the image property in order to display this image to the passcode views.

    • The image view will not be displayed if its image property is not set.
    • Developer can set the imageViewSize property to a specified size. Otherwise, the default size will be used when imageViewSize property is nil.

    Declaration

    Swift

    public internal(set) var imageView: UIImageView { get }
  • The size of the image view.

    If this property is nil, the default size of 256 px width and 54 px height is used. Note that the the maximum width is limited to 256 px and the maximum height is limited to 54 px.

    Declaration

    Swift

    public var imageViewSize: CGSize?
  • The flag indicating if the action button is on navigation bar or on the bottom of the passcode view.

    The default value is true, which means the action button is on the navigation bar.

    Declaration

    Swift

    public var isActionButtonOnNavigationBar: Bool
  • The action button on the passcode view.

    This button is to be shown only when isActionButtonOnNavigationBar is false.

    Declaration

    Swift

    public internal(set) var actionButton: FUIButton { get }
  • Creates a FUIPasscodeChangeController object from storyboard.

    Declaration

    Swift

    public class func createInstanceFromStoryboard() -> FUIPasscodeChangeController

    Return Value

    A FUIPasscodeChangeController object.