Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
Fix bug use wrong cookies after enter an user that already exist
Browse files Browse the repository at this point in the history
  • Loading branch information
nasli committed Nov 22, 2017
1 parent 0810797 commit c880762
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
8 changes: 4 additions & 4 deletions Owncloud iOs Client/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,9 @@ + (OCCommunication*)sharedOCCommunication
authorizationEndpoint:k_oauth2_authorization_endpoint
tokenEndpoint:k_oauth2_token_endpoint];

[sharedOCCommunication setOauth2Configuration: ocOAuth2conf];
[sharedOCCommunication setValueOauth2Configuration: ocOAuth2conf];

[sharedOCCommunication setUserAgent:[UtilsUrls getUserAgent]];
[sharedOCCommunication setValueOfUserAgent:[UtilsUrls getUserAgent]];

OCKeychain *oKeychain = [[OCKeychain alloc] init];
[sharedOCCommunication setValueCredentialsStorage:oKeychain];
Expand Down Expand Up @@ -639,9 +639,9 @@ + (OCCommunication*)sharedOCCommunicationDownloadFolder {
authorizationEndpoint:k_oauth2_authorization_endpoint
tokenEndpoint:k_oauth2_token_endpoint];

[sharedOCCommunicationDownloadFolder setOauth2Configuration:ocOAuth2conf];
[sharedOCCommunicationDownloadFolder setValueOauth2Configuration:ocOAuth2conf];

[sharedOCCommunicationDownloadFolder setUserAgent:[UtilsUrls getUserAgent]];
[sharedOCCommunicationDownloadFolder setValueOfUserAgent:[UtilsUrls getUserAgent]];

OCKeychain *oKeychain = [[OCKeychain alloc] init];
[sharedOCCommunicationDownloadFolder setValueCredentialsStorage:oKeychain];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,9 @@ public enum TextfieldType: String {

if tryingToUpdateDifferentUser {
self.showCredentialsError(NSLocalizedString("credentials_different_user", comment: "") )
//Delete current wrong cookies and relaunch check url to get correct ones
UtilsFramework.deleteAllCookies()
self.checkCurrentUrl()

} else {

Expand All @@ -885,6 +888,9 @@ public enum TextfieldType: String {

if (ManageUsersDB.isExistUser(self.user)) {
self.showURLError(NSLocalizedString("account_not_new", comment: ""))
//Delete current wrong cookies and relaunch check url to get correct ones
UtilsFramework.deleteAllCookies()
self.checkCurrentUrl()

} else {

Expand Down
10 changes: 3 additions & 7 deletions Owncloud iOs Client/Network/UserData/DetectUserData.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,12 @@ @implementation DetectUserData

+ (void) getUserDisplayNameOfServer:(NSString*)path credentials:(OCCredentialsDto *)credentials
withCompletion:(void(^)(NSString *displayName, NSError *error))completion {
OCCommunication *sharedCommunication;

sharedCommunication = [AppDelegate sharedOCCommunication];


[sharedCommunication setCredentials:credentials];
[[AppDelegate sharedOCCommunication] setCredentials:credentials];

[sharedCommunication setValueOfUserAgent:[UtilsUrls getUserAgent]];
[[AppDelegate sharedOCCommunication] setValueOfUserAgent:[UtilsUrls getUserAgent]];

[sharedCommunication getUserDisplayNameOfServer:path onCommunication:sharedCommunication
[[AppDelegate sharedOCCommunication] getUserDisplayNameOfServer:path onCommunication:[AppDelegate sharedOCCommunication]
success:^(NSHTTPURLResponse *response, NSString *displayName, NSString *redirectedServer) {
if (displayName && ![displayName isEqualToString:@""]) {
completion(displayName, nil);
Expand Down
4 changes: 2 additions & 2 deletions ownCloudExtApp/DocumentPickerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ + (OCCommunication*)sharedOCCommunication
authorizationEndpoint:k_oauth2_authorization_endpoint
tokenEndpoint:k_oauth2_token_endpoint];

[sharedOCCommunication setOauth2Configuration: ocOAuth2conf];
[sharedOCCommunication setValueOauth2Configuration: ocOAuth2conf];

[sharedOCCommunication setUserAgent:[UtilsUrls getUserAgent]];
[sharedOCCommunication setValueOfUserAgent:[UtilsUrls getUserAgent]];

OCKeychain *oKeychain = [[OCKeychain alloc] init];
[sharedOCCommunication setValueCredentialsStorage:oKeychain];
Expand Down

0 comments on commit c880762

Please sign in to comment.