diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9c0ea57a57..ef6d180616 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+Changes in [0.11.2](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v0.11.2) (2017-11-28)
+=====================================================================================================
+[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v0.11.1...v0.11.2)
+
+ * Ignore unrecognised login flows
+ [\#1633](https://github.com/matrix-org/matrix-react-sdk/pull/1633)
+
Changes in [0.11.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v0.11.1) (2017-11-17)
=====================================================================================================
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v0.11.0...v0.11.1)
diff --git a/package.json b/package.json
index 2970beb6b3..b443b4c72a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "matrix-react-sdk",
- "version": "0.11.1",
+ "version": "0.11.2",
"description": "SDK for matrix.org using React",
"author": "matrix.org",
"repository": {
diff --git a/src/components/structures/login/Login.js b/src/components/structures/login/Login.js
index baa2064277..9ed710534b 100644
--- a/src/components/structures/login/Login.js
+++ b/src/components/structures/login/Login.js
@@ -77,6 +77,14 @@ module.exports = React.createClass({
componentWillMount: function() {
this._unmounted = false;
+
+ // map from login step type to a function which will render a control
+ // letting you do that login type
+ this._stepRendererMap = {
+ 'm.login.password': this._renderPasswordStep,
+ 'm.login.cas': this._renderCasStep,
+ };
+
this._initLoginLogic();
},
@@ -233,13 +241,29 @@ module.exports = React.createClass({
loginIncorrect: false,
});
- loginLogic.getFlows().then(function(flows) {
- // old behaviour was to always use the first flow without presenting
- // options. This works in most cases (we don't have a UI for multiple
- // logins so let's skip that for now).
- loginLogic.chooseFlow(0);
- self.setState({
- currentFlow: self._getCurrentFlowStep(),
+ loginLogic.getFlows().then((flows) => {
+ // look for a flow where we understand all of the steps.
+ for (let i = 0; i < flows.length; i++ ) {
+ if (!this._isSupportedFlow(flows[i])) {
+ continue;
+ }
+
+ // we just pick the first flow where we support all the
+ // steps. (we don't have a UI for multiple logins so let's skip
+ // that for now).
+ loginLogic.chooseFlow(i);
+ this.setState({
+ currentFlow: this._getCurrentFlowStep(),
+ });
+ return;
+ }
+ // we got to the end of the list without finding a suitable
+ // flow.
+ this.setState({
+ errorText: _t(
+ "This homeserver doesn't offer any login flows which are " +
+ "supported by this client.",
+ ),
});
}, function(err) {
self.setState({
@@ -253,6 +277,16 @@ module.exports = React.createClass({
}).done();
},
+ _isSupportedFlow: function(flow) {
+ // technically the flow can have multiple steps, but no one does this
+ // for login and loginLogic doesn't support it so we can ignore it.
+ if (!this._stepRendererMap[flow.type]) {
+ console.log("Skipping flow", flow, "due to unsupported login type", flow.type);
+ return false;
+ }
+ return true;
+ },
+
_getCurrentFlowStep: function() {
return this._loginLogic ? this._loginLogic.getCurrentFlowStep() : null;
},
@@ -294,41 +328,42 @@ module.exports = React.createClass({
},
componentForStep: function(step) {
- switch (step) {
- case 'm.login.password': {
- const PasswordLogin = sdk.getComponent('login.PasswordLogin');
- return (
-