Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // The SDK is initialized as shared instance so can be accessed
- // from multiple View Controllers
- let sdkNoUser:AcceptSDK = AcceptSDK.sharedInstance()
- // Set the SDK target environment - in this case Public Test
- // for remind username and reset password the SDK does not need to be authenticated
- sdkNoUser.setup(with: AcceptEnvironment.publicTest,
- username: nil,
- password: nil)
- //End of credential management process
- let completion:CredentialManagementCompletion = {(result:WDAcceptResult?, error:Error?) in
- //result - details from the credential management process
- // AcceptResultStatusOK indicates the process ended with OK status
- // AcceptResultStatusPasswordCriteriaNotMet - in the case of changing the password indicates that the new password does not
- // meet the criteria
- // AcceptResultStatusPasswordValidationFailure - in the case of changing password indicates the password validation failure
- // old and new password mismatch
- }
- //******************* PASSWORD POLICY *******************//
- //End of password policy process
- let policyCompletion:PasswordPolicyCompletion = {(policy:WDPasswordPolicyResult? , error:Error?) in
- //policy - the details of the password policy
- }
- //Obtain the password policy valid for the user credentials on this system
- sdkNoUser.userManager.passwordPolicy(policyCompletion)
- //******************* REMIND USERNAME *******************//
- //Remind username
- let remindUserName:WDAcceptRemindUsername = WDAcceptRemindUsername()
- remindUserName.email = "User@Email" // email address to send the remind message to
- // Remind username - the message will be sent to specified email address
- sdkNoUser.userManager.manageCredentials(remindUserName, // Remind username object
- completion:completion) // End of credential management process
- //******************* RESET PASSWORD *******************//
- let resetPassword:WDAcceptRequestPasswordReset = WDAcceptRequestPasswordReset()
- resetPassword.username = "UserName" // username for which to reset the password
- //Reset password - instructions will be sent to the specified user email address (as stored on the backend)
- sdkNoUser.userManager.manageCredentials(resetPassword, // Reset password object
- completion:completion) // End of credential management process
- //******************* CHANGE PASSWORD *******************//
- // Change Password details - available only to the AUTHENTICATED user
- let changePassword:WDAcceptChangePassword = WDAcceptChangePassword()
- changePassword.currentPassword = "Old Password" // old password of the current user
- changePassword.setNewPassword = "New Password" // new password of the current user
- // Change password for the currently logged in user
- sdk.userManager.manageCredentials(changePassword, // Change password object
- completion:completion)//End of credential management process
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement