Skip to content

Commit

Permalink
add password expired to sendRequestAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
lilthree authored and Wei Wang committed Nov 18, 2017
1 parent 1d16402 commit 39733c1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions Pod/Classes/SeafConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
#import "SeafCacheProvider.h"
#import "SeafBase.h"

#define HTTP_ERR_UNAUTHORIZED 401
#define HTTP_ERR_LOGIN_INCORRECT_PASSWORD 400
#define HTTP_ERR_REPO_PASSWORD_REQUIRED 440
#define HTTP_ERR_OPERATION_FAILED 520
#define HTTP_ERR_REPO_PASSWORD_EXPIRED 500

#define HTTP_ERR_UNAUTHORIZED 401
#define HTTP_ERR_LOGIN_INCORRECT_PASSWORD 400
#define HTTP_ERR_REPO_PASSWORD_REQUIRED 440
#define HTTP_ERR_OPERATION_FAILED 520
#define HTTP_ERR_REPO_UPLOAD_PASSWORD_EXPIRED 500
#define HTTP_ERR_REPO_DOWNLOAD_PASSWORD_EXPIRED 400

#define DEFAULT_TIMEOUT 120
#define LARGE_FILE_SIZE 10*1024*1024
Expand Down
2 changes: 2 additions & 0 deletions Pod/Classes/SeafConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,8 @@ - (void)sendRequestAsync:(NSString *)url method:(NSString *)method form:(NSStrin
Warning("Out of quota.");
[self.delegate outOfQuota:self];
}
} else if (resp.statusCode == HTTP_ERR_REPO_DOWNLOAD_PASSWORD_EXPIRED) {
[self refreshRepoPassowrds];
}
} else {
success(request, resp, responseObject);
Expand Down
2 changes: 1 addition & 1 deletion Pod/Classes/SeafUploadFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ - (void)uploadRequest:(NSMutableURLRequest *)request withConnection:(SeafConnect
}
if (error) {
Debug("Upload failed :%@,code=%ld, res=%@\n", error, (long)resp.statusCode, responseObject);
if (resp.statusCode == HTTP_ERR_REPO_PASSWORD_EXPIRED || resp.statusCode == HTTP_ERR_LOGIN_INCORRECT_PASSWORD) {
if (resp.statusCode == HTTP_ERR_REPO_UPLOAD_PASSWORD_EXPIRED || resp.statusCode == HTTP_ERR_REPO_DOWNLOAD_PASSWORD_EXPIRED) {
//refredh passwords when expired
[connection refreshRepoPassowrds];
}
Expand Down

0 comments on commit 39733c1

Please sign in to comment.