no message

This commit is contained in:
Giuseppe Nucifora 2016-02-15 16:51:22 +01:00
parent bef8607419
commit d59d446285
3 changed files with 19 additions and 17 deletions

View File

@ -118,11 +118,11 @@
NSLog(@"%@",[user JSONFormObject]); NSLog(@"%@",[user JSONFormObject]);
//NSLog(@"%@",[user JSONObjectMap]); //NSLog(@"%@",[user JSONObjectMap]);
[user registerWithBlockSuccess:^(PNUser * _Nullable responseObject) { /*[user registerWithBlockSuccess:^(PNUser * _Nullable responseObject) {
} failure:^(NSError * _Nonnull error) { } failure:^(NSError * _Nonnull error) {
}]; }];*/
/*[[User currentUser] socialLoginWithBlockSuccessFromViewController:self /*[[User currentUser] socialLoginWithBlockSuccessFromViewController:self
blockSuccess:^(PNUser * _Nullable responseObject) { blockSuccess:^(PNUser * _Nullable responseObject) {
@ -131,17 +131,17 @@
}];*/ }];*/
/*User * user = [User currentUser]; //User * user = [User currentUser];
if ([user isAuthenticated]) { //if ([user isAuthenticated]) {
[user loginCurrentUserWithEmail:@"packman@giuseppenucifora.com" password:@"asdasdasd" withBlockSuccess:^(PNUser * _Nullable responseObject) { [User loginCurrentUserWithEmail:@"packman@giuseppenucifora.com" password:@"asdasdasd" withBlockSuccess:^(PNUser * _Nullable responseObject) {
NSLog(@"response : %@",responseObject);
} failure:^(NSError * _Nonnull error) {
NSLog(@"response : %@",error);
}];
NSLog(@"response : %@",responseObject);
} failure:^(NSError * _Nonnull error) {
NSLog(@"response : %@",error);
}];
}*/
} }
- (void)didReceiveMemoryWarning - (void)didReceiveMemoryWarning

View File

@ -54,7 +54,7 @@
* @param success <#success description#> * @param success <#success description#>
* @param failure <#failure description#> * @param failure <#failure description#>
*/ */
- (void) loginCurrentUserWithEmail:(NSString * _Nonnull) email + (void) loginCurrentUserWithEmail:(NSString * _Nonnull) email
password:(NSString * _Nonnull) password password:(NSString * _Nonnull) password
withBlockSuccess:(nullable void (^)(PNUser * _Nullable responseObject))success withBlockSuccess:(nullable void (^)(PNUser * _Nullable responseObject))success
failure:(nullable void (^)(NSError * _Nonnull error))failure; failure:(nullable void (^)(NSError * _Nonnull error))failure;

View File

@ -259,24 +259,26 @@ static bool isFirstAccess = YES;
}];*/ }];*/
} }
- (void) loginCurrentUserWithEmail:(NSString * _Nonnull) email + (void) loginCurrentUserWithEmail:(NSString * _Nonnull) email
password:(NSString * _Nonnull) password password:(NSString * _Nonnull) password
withBlockSuccess:(nullable void (^)(PNUser * _Nullable responseObject))success withBlockSuccess:(nullable void (^)(PNUser * _Nullable responseObject))success
failure:(nullable void (^)(NSError * _Nonnull error))failure { failure:(nullable void (^)(NSError * _Nonnull error))failure {
[[PNObjectConfig sharedInstance] refreshTokenForUserWithEmail:email password:password withBlockSuccess:^(BOOL refreshSuccess) { [[PNObjectConfig sharedInstance] refreshTokenForUserWithEmail:email password:password withBlockSuccess:^(BOOL refreshSuccess) {
if (refreshSuccess) { if (refreshSuccess) {
PNUser *user = [[self class] new];
PNObjcPassword *objectPassword = [PNObjcPassword new]; PNObjcPassword *objectPassword = [PNObjcPassword new];
[objectPassword setPassword:password]; [objectPassword setPassword:password];
[objectPassword setConfirmPassword:password]; [objectPassword setConfirmPassword:password];
[self setAuthenticated:YES]; [user setAuthenticated:YES];
[self setEmail:email]; [user setEmail:email];
[self setPassword:objectPassword]; [user setPassword:objectPassword];
[self saveLocally]; [user saveLocally];
if (success) { if (success) {
success(self); success(user);
} }
} }
} failure:failure]; } failure:failure];