FUIPasscodeChangeController
public class FUIPasscodeChangeController : UINavigationController
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 bothFUIPasscodeInputController
andFUIPasscodeCreateController
. - 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 delegat’sshouldTryPasscode
is invoked to validate the old passcode. And a new passcode is generated andshouldTryPasscode
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
. TheFUIPasscodeControllerDelegate
provided functionvalidate
ofvalidationDelegate
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 theFUIPasscodeControllerDelegate
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 theFUIPasscodeChangeController
storyboard in theSAPFiori
framework bundle. The app developer must provide the required properties in theUIController
‘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)
-
An implementation of
FUIPasscodeControllerDelegate
passedFUIPasscodeInputController
andFUIPasscodeCreateController
.Declaration
Swift
public weak var passcodeControllerDelegate: FUIPasscodeControllerDelegate?
-
An implementaiton of
FUIPasscodeValidationDelegate
passed toFUIPasscodeCreateController
for additional passcode validations during passcode create/changeDeclaration
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 isfalse
.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, user needs to input the passcode to authenticat even if Touch ID or Face ID is enabled. The default is
false
.Declaration
Swift
public var isRequiringAlphaNumericInput: Bool
-
Creates a
FUIPasscodeChangeController
object from storyboard.Declaration
Swift
public class func createInstanceFromStoryboard() -> FUIPasscodeChangeController
Return Value
A
FUIPasscodeChangeController
object.