Merge branch 'develop' into 'master'
- Fix check currentUser See merge request !18
This commit is contained in:
commit
ea6cb89248
@ -8,7 +8,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "PNObject"
|
||||
s.version = "0.3.1"
|
||||
s.version = "0.3.2"
|
||||
s.summary = "PNObject is a simple replica of the more complex ParseObject"
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
|
||||
@ -29,6 +29,8 @@
|
||||
*/
|
||||
- (void) logout;
|
||||
|
||||
- (BOOL) isValidUser;
|
||||
|
||||
//- (void) setPassword:(NSString * _Nonnull)password inBackGroundWithBlock:(nullable void (^)(BOOL saveStatus, id responseObject, NSError * error)) responseBlock;
|
||||
|
||||
///--------------------------------------
|
||||
|
||||
@ -102,6 +102,14 @@ static bool isFirstAccess = YES;
|
||||
[self resetObject];
|
||||
}
|
||||
|
||||
- (BOOL) isValidUser {
|
||||
if(self.username && self.password && [self isValidPassword:[self password]]){
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
#pragma mark PNObjectSubclassing Protocol
|
||||
|
||||
+ (NSDictionary *)objcetMapping {
|
||||
|
||||
@ -224,7 +224,7 @@ static bool isFirstAccess = YES;
|
||||
}
|
||||
|
||||
- (void) tryRefreshToken {
|
||||
if ([PNUser currentUser]) {
|
||||
if ([PNUser currentUser] && [[PNUser currentUser] isValidUser]) {
|
||||
[_manager authenticateUsingOAuthWithURLString:[_currentEndPointBaseUrl stringByAppendingString:@"oauth-token"] username:[[PNUser currentUser] username] password:[[PNUser currentUser] password] scope:nil success:^(AFOAuthCredential * _Nonnull credential) {
|
||||
_currentOauthCredential = credential;
|
||||
[_manager.requestSerializer setAuthorizationHeaderFieldWithCredential:_currentOauthCredential];
|
||||
|
||||
@ -21,11 +21,10 @@
|
||||
// THE SOFTWARE
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AFNetworking/AFNetworking.h>
|
||||
#import "AFOAuthCredential.h"
|
||||
#import "AFHTTPRequestSerializer+OAuth2.h"
|
||||
|
||||
@import AFNetworking;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface AFOAuth2Manager : AFHTTPSessionManager
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user