mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-05 23:47:44 +02:00
Merge pull request #3165 from vector-im/remove_login_fallback
Remove login fallback to m.org when authentication failed
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
Changes in 0.11.2 (2020-xx-xx)
|
||||
===============================================
|
||||
|
||||
Bug fix:
|
||||
* AuthenticationViewController: Remove fallback to matrix.org when authentication failed (PR #3165).
|
||||
|
||||
Changes in 0.11.1 (2020-04-24)
|
||||
===============================================
|
||||
|
||||
|
||||
@@ -27,12 +27,6 @@
|
||||
|
||||
@interface AuthenticationViewController () <AuthFallBackViewControllerDelegate, KeyVerificationCoordinatorBridgePresenterDelegate>
|
||||
{
|
||||
/**
|
||||
Store the potential login error received by using a default homeserver different from matrix.org
|
||||
while we retry a login process against the matrix.org HS.
|
||||
*/
|
||||
NSError *loginError;
|
||||
|
||||
/**
|
||||
The default country code used to initialize the mobile phone number input.
|
||||
*/
|
||||
@@ -289,15 +283,6 @@
|
||||
|
||||
super.authType = authType;
|
||||
|
||||
// Check a potential stored error.
|
||||
if (loginError)
|
||||
{
|
||||
// Restore the default HS
|
||||
NSLog(@"[AuthenticationVC] Switch back to default homeserver");
|
||||
[self setHomeServerTextFieldText:nil];
|
||||
loginError = nil;
|
||||
}
|
||||
|
||||
if (authType == MXKAuthenticationTypeLogin)
|
||||
{
|
||||
[self.submitButton setTitle:NSLocalizedStringFromTable(@"auth_login", @"Vector", nil) forState:UIControlStateNormal];
|
||||
@@ -845,67 +830,6 @@
|
||||
|
||||
- (void)onFailureDuringAuthRequest:(NSError *)error
|
||||
{
|
||||
// Homeserver migration: When the default homeserver url is different from matrix.org,
|
||||
// the login (or forgot pwd) process with an existing matrix.org accounts will then fail.
|
||||
// Patch: Falling back to matrix.org HS so we don't break everyone's logins
|
||||
if ([self.homeServerTextField.text isEqualToString:self.defaultHomeServerUrl] && ![self.defaultHomeServerUrl isEqualToString:@"https://matrix.org"] && !self.softLogoutCredentials)
|
||||
{
|
||||
MXError *mxError = [[MXError alloc] initWithNSError:error];
|
||||
|
||||
if (self.authType == MXKAuthenticationTypeLogin)
|
||||
{
|
||||
if (mxError && [mxError.errcode isEqualToString:kMXErrCodeStringForbidden])
|
||||
{
|
||||
// Falling back to matrix.org HS
|
||||
NSLog(@"[AuthenticationVC] Retry login against matrix.org");
|
||||
|
||||
// Store the current error, and change the homeserver url
|
||||
loginError = error;
|
||||
[self setHomeServerTextFieldText:@"https://matrix.org"];
|
||||
|
||||
// Trigger a new request
|
||||
[self onButtonPressed:self.submitButton];
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (self.authType == MXKAuthenticationTypeForgotPassword)
|
||||
{
|
||||
if (mxError && [mxError.errcode isEqualToString:kMXErrCodeStringNotFound])
|
||||
{
|
||||
// Sanity check
|
||||
if ([self.authInputsView isKindOfClass:ForgotPasswordInputsView.class])
|
||||
{
|
||||
// Falling back to matrix.org HS
|
||||
NSLog(@"[AuthenticationVC] Retry forgot password against matrix.org");
|
||||
|
||||
// Store the current error, and change the homeserver url
|
||||
loginError = error;
|
||||
[self setHomeServerTextFieldText:@"https://matrix.org"];
|
||||
|
||||
// Trigger a new request
|
||||
ForgotPasswordInputsView *authInputsView = (ForgotPasswordInputsView*)self.authInputsView;
|
||||
[authInputsView.nextStepButton sendActionsForControlEvents:UIControlEventTouchUpInside];
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether we were retrying against matrix.org HS
|
||||
if (loginError)
|
||||
{
|
||||
// This is not an existing matrix.org accounts
|
||||
NSLog(@"[AuthenticationVC] This is not an existing matrix.org accounts");
|
||||
|
||||
// Restore the default HS
|
||||
[self setHomeServerTextFieldText:nil];
|
||||
|
||||
// Consider the original login error
|
||||
[super onFailureDuringAuthRequest:loginError];
|
||||
loginError = nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
MXError *mxError = [[MXError alloc] initWithNSError:error];
|
||||
if ([mxError.errcode isEqualToString:kMXErrCodeStringResourceLimitExceeded])
|
||||
{
|
||||
@@ -915,7 +839,6 @@
|
||||
{
|
||||
[super onFailureDuringAuthRequest:error];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onSuccessfulLogin:(MXCredentials*)credentials
|
||||
|
||||
Reference in New Issue
Block a user