Simplify SSO step checking

pull/21833/head
Travis Ralston 2020-03-04 12:26:08 -07:00
parent 3842bce74d
commit 2204785026
1 changed files with 3 additions and 6 deletions

View File

@ -152,10 +152,6 @@ export default createReactClass({
return this.state.busy || this.props.busy;
},
_isSsoStep: function() {
return this._getCurrentFlowStep() === 'm.login.sso' || this._getCurrentFlowStep() === 'm.login.cas';
},
onPasswordLogin: async function(username, phoneCountry, phoneNumber, password) {
if (!this.state.serverIsAlive) {
this.setState({busy: true});
@ -345,12 +341,13 @@ export default createReactClass({
},
onTryRegisterClick: function(ev) {
if (this._isSsoStep()) {
const step = this._getCurrentFlowStep();
if (step === 'm.login.sso' || step === 'm.login.cas') {
// If we're showing SSO it means that registration is also probably disabled,
// so intercept the click and instead pretend the user clicked 'Sign in with SSO'.
ev.preventDefault();
ev.stopPropagation();
const ssoKind = this._getCurrentFlowStep() === 'm.login.sso' ? 'sso' : 'cas';
const ssoKind = step === 'm.login.sso' ? 'sso' : 'cas';
PlatformPeg.get().startSingleSignOn(this._loginLogic.createTemporaryClient(), ssoKind);
} else {
// Don't intercept - just go through to the register page