Skip to content

Commit

Permalink
Merge pull request #1060 from vector-im/riot_912
Browse files Browse the repository at this point in the history
Bug Fix - Registration: support the dummy authentication flow.
  • Loading branch information
giomfo authored Feb 24, 2017
2 parents c6cf940 + 94235bb commit fb49fe7
Showing 1 changed file with 29 additions and 1 deletion.
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

0 comments on commit fb49fe7

Please sign in to comment.