Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Fix - Registration: support the dummy authentication flow. #1060

Merged
merged 1 commit into from
Feb 24, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion Vector/Views/Authentication/AuthInputsView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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}
};
}
}
}

Expand Down Expand Up @@ -729,6 +737,10 @@ - (BOOL)isSupportedFlowType:(MXLoginFlowType)flowType
{
return YES;
}
else if ([flowType isEqualToString:kMXLoginFlowTypeDummy])
{
return YES;
}

return NO;
}
Expand Down Expand Up @@ -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