From 94235bb519e050bead2386ce13b27a52e59892b7 Mon Sep 17 00:00:00 2001 From: giomfo Date: Fri, 24 Feb 2017 12:10:47 +0100 Subject: [PATCH] Bug Fix - Registration: support the dummy authentication flow. #912 --- Vector/Views/Authentication/AuthInputsView.m | 30 +++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Vector/Views/Authentication/AuthInputsView.m b/Vector/Views/Authentication/AuthInputsView.m index 8ca5791508..c0eca6ac61 100644 --- a/Vector/Views/Authentication/AuthInputsView.m +++ b/Vector/Views/Authentication/AuthInputsView.m @@ -427,14 +427,22 @@ - (void)prepareParameters:(void (^)(NSDictionary *parameters))callback // Async response return; } - else if (self.isPasswordBasedFlowSupported) + else if (self.isDummyFlowSupported) { parameters = @{ + @"auth": @{@"session":currentSession.session, @"type": kMXLoginFlowTypeDummy}, @"username": self.userLoginTextField.text, @"password": self.passWordTextField.text, @"bind_email": @(NO) }; } + else if (self.isPasswordBasedFlowSupported) + { + // Note: this use case was not tested yet. + parameters = @{ + @"auth": @{@"session":currentSession.session, @"username": self.userLoginTextField.text, @"password": self.passWordTextField.text, @"type": kMXLoginFlowTypePassword} + }; + } } } @@ -729,6 +737,10 @@ - (BOOL)isSupportedFlowType:(MXLoginFlowType)flowType { return YES; } + else if ([flowType isEqualToString:kMXLoginFlowTypeDummy]) + { + return YES; + } return NO; } @@ -900,4 +912,20 @@ - (BOOL)isRecaptchaFlowRequired return NO; } +- (BOOL)isDummyFlowSupported +{ + if (currentSession) + { + for (MXLoginFlow *loginFlow in currentSession.flows) + { + if ([loginFlow.stages indexOfObject:kMXLoginFlowTypeDummy] != NSNotFound || [loginFlow.type isEqualToString:kMXLoginFlowTypeDummy]) + { + return YES; + } + } + } + + return NO; +} + @end