From 6d289c0ae7dfd4ec65543bcbec9972e8c8098c0a Mon Sep 17 00:00:00 2001 From: Alex Moller Date: Tue, 15 Dec 2015 15:06:24 -0700 Subject: [PATCH] added logging in with meteor username --- Meteor/METDDPClient+AccountsPassword.h | 2 ++ Meteor/METDDPClient+AccountsPassword.m | 4 ++++ 2 files changed, 6 insertions(+) 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]; }