From 39733c16ea89743f0e4c25a94a7a828752efe19b Mon Sep 17 00:00:00 2001 From: lilthree <87437904@qq.com> Date: Tue, 14 Nov 2017 00:00:55 +0800 Subject: [PATCH] add password expired to sendRequestAsync --- Pod/Classes/SeafConnection.h | 12 ++++++------ Pod/Classes/SeafConnection.m | 2 ++ Pod/Classes/SeafUploadFile.m | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Pod/Classes/SeafConnection.h b/Pod/Classes/SeafConnection.h index 38d0d510..7515667c 100644 --- a/Pod/Classes/SeafConnection.h +++ b/Pod/Classes/SeafConnection.h @@ -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 diff --git a/Pod/Classes/SeafConnection.m b/Pod/Classes/SeafConnection.m index f098833b..4b828ef7 100644 --- a/Pod/Classes/SeafConnection.m +++ b/Pod/Classes/SeafConnection.m @@ -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); diff --git a/Pod/Classes/SeafUploadFile.m b/Pod/Classes/SeafUploadFile.m index c0feefb5..0dc35a81 100644 --- a/Pod/Classes/SeafUploadFile.m +++ b/Pod/Classes/SeafUploadFile.m @@ -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]; }