diff --git a/Meteor/METDDPClient+AccountsPassword.h b/Meteor/METDDPClient+AccountsPassword.h index 5c5942e..ae06106 100644 --- a/Meteor/METDDPClient+AccountsPassword.h +++ b/Meteor/METDDPClient+AccountsPassword.h @@ -30,6 +30,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)loginWithEmail:(NSString *)email password:(NSString *)password completionHandler:(nullable METLogInCompletionHandler)completionHandler; +- (void)loginWithUsername:(NSString *)username password:(NSString *)password completionHandler:(nullable METLogInCompletionHandler)completionHandler; + /// @name Signing Up with Password - (void)signUpWithEmail:(NSString *)email password:(NSString *)password completionHandler:(nullable METLogInCompletionHandler)completionHandler; diff --git a/Meteor/METDDPClient+AccountsPassword.m b/Meteor/METDDPClient+AccountsPassword.m index 90960b6..615f6cd 100644 --- a/Meteor/METDDPClient+AccountsPassword.m +++ b/Meteor/METDDPClient+AccountsPassword.m @@ -29,6 +29,10 @@ - (void)loginWithEmail:(NSString *)email password:(NSString *)password completio [self loginWithMethodName:@"login" parameters:@[@{@"user": @{@"email": email}, @"password": @{@"digest": [password SHA256String], @"algorithm": @"sha-256"}}] completionHandler:completionHandler]; } +- (void)loginWithUsername:(NSString *)username password:(NSString *)password completionHandler:(METLogInCompletionHandler)completionHandler { + [self loginWithMethodName:@"login" parameters:@[@{@"user": @{@"username": username}, @"password": @{@"digest": [password SHA256String], @"algorithm": @"sha-256"}}] completionHandler:completionHandler]; +} + - (void)signUpWithEmail:(NSString *)email password:(NSString *)password completionHandler:(METLogInCompletionHandler)completionHandler { [self signUpWithEmail:email password:password profile:nil completionHandler:completionHandler]; }