NMAPasswordChange
@objc
public protocol NMAPasswordChange : NMAOperation
The object that can be used to change the password.
Usage example:
@interface NMAPasswordChangerImpl : NSObject<NMAPasswordChanger>
@end
@implementation NMAPasswordChangerImpl
- (void)changePasswordWithContext:(id<NMAPasswordChangeContext> _Nonnull)context handler:(id<NMAPasswordChangeHandler> _Nonnull)handler {
[handler passwordsWithOldPassword:oldPassword newPassword:newPassword];
}
@end
id<NMAPasswordChange> passwordChangeOperation = [[client operations] passwordChange];
[passwordChangeOperation username:username];
[passwordChangeOperation passwordChanger:[[NMAPasswordChangerImpl alloc] init]];
[passwordChangeOperation onSuccess:^{...}];
[passwordChangeOperation onError:^(NMAPasswordChangeError * _Nonnull error) {...}];
[passwordChangeOperation execute];
-
The username whose password must be changed.
Important
Providing the username is required.Declaration
Swift
@discardableResult func username(_ username: String) -> NMAPasswordChange
Parameters
username
the username.
Return Value
the
NMAPasswordChange
builder. -
Specifies the object that will be informed of the potential recoverable errors and is responsible for obtaining the password from the end-user.
Important
Providing the password changer is required.Declaration
Swift
@discardableResult func passwordChanger(_ passwordChanger: NMAPasswordChanger) -> NMAPasswordChange
Parameters
passwordChanger
Return Value
the
NMAPasswordChange
builder. -
Specifies the block to execute if the password was successfully modified.
Important
Providing theonSuccess
block is required.Declaration
Swift
@discardableResult func onSuccess(_ onSuccess: @escaping () -> ()) -> NMAPasswordChange
Parameters
onSuccess
the block to execute on successful password modification.
Return Value
the
NMAPasswordChange
builder. -
Specifies the block to execute when the password could not be changed: - the password was not enrolled, - the password is locked - or the operation was canceled.
Important
Providing theonError
block is required.Declaration
Swift
@discardableResult func onError(_ onError: @escaping (NMAPasswordChangeError) -> ()) -> NMAPasswordChange
Parameters
onError
the block to execute on failed password modification, receives an
NMAPasswordChangeError
.Return Value
the
NMAPasswordChange
builder.