mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-01 05:36:57 +02:00
Merge remote-tracking branch 'origin/develop' into auth_forgot_password
This commit is contained in:
@@ -23,6 +23,17 @@
|
||||
|
||||
#import "VectorDesignValues.h"
|
||||
|
||||
@interface AuthenticationViewController ()
|
||||
{
|
||||
/**
|
||||
Store the potential login error received by using the new default homeserver (vector.im)
|
||||
while we retry a login process against the matrix.org HS.
|
||||
*/
|
||||
NSError *loginError;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation AuthenticationViewController
|
||||
|
||||
+ (UINib *)nib
|
||||
@@ -232,6 +243,48 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onFailureDuringAuthRequest:(NSError *)error
|
||||
{
|
||||
// Homeserver migration: the default homeserver url has been updated with https://vector.im.
|
||||
// The login 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.authType == MXKAuthenticationTypeLogin)
|
||||
{
|
||||
if ([self.homeServerTextField.text isEqualToString:@"https://vector.im"])
|
||||
{
|
||||
MXError *mxError = [[MXError alloc] initWithNSError:error];
|
||||
if (mxError && [mxError.errcode isEqualToString:kMXErrCodeStringForbidden])
|
||||
{
|
||||
// Retry against the matrix.org HS
|
||||
NSLog(@"[MXKAuthenticationVC] Falling back to matrix.org HS");
|
||||
|
||||
loginError = error;
|
||||
[self setHomeServerTextFieldText:@"https://matrix.org"];
|
||||
|
||||
[self onButtonPressed:self.submitButton];
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (loginError)
|
||||
{
|
||||
// This is not an existing matrix.org accounts
|
||||
NSLog(@"[MXKAuthenticationVC] This is not an existing matrix.org accounts");
|
||||
|
||||
// Restore the default HS
|
||||
[self setHomeServerTextFieldText: @"https://vector.im"];
|
||||
|
||||
// Consider the original login error
|
||||
[super onFailureDuringAuthRequest:loginError];
|
||||
loginError = nil;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
[super onFailureDuringAuthRequest:loginError];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)hideServerOptionsContainer:(BOOL)hidden
|
||||
|
||||
Reference in New Issue
Block a user