revert stale changes

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-03-27 14:05:14 +00:00
parent db6f88c66a
commit f4d3cc8ee6
3 changed files with 12 additions and 37 deletions

View file

@ -53,10 +53,6 @@ _td("Invalid base_url for m.identity_server");
_td("Identity server URL does not appear to be a valid identity server");
_td("General failure");
const M_LOGIN_CAS = "m.login.cas";
const M_LOGIN_SSO = "m.login.sso";
const SSO_FLOWS = [M_LOGIN_SSO, M_LOGIN_CAS];
/**
* A wire component which glues together login UI components and Login logic
*/
@ -126,11 +122,11 @@ export default createReactClass({
'm.login.password': this._renderPasswordStep,
// CAS and SSO are the same thing, modulo the url we link to
[M_LOGIN_CAS]: () => this._renderSsoStep("cas"),
[M_LOGIN_SSO]: () => this._renderSsoStep("sso"),
'm.login.cas': () => this._renderSsoStep("cas"),
'm.login.sso': () => this._renderSsoStep("sso"),
};
this._initLoginLogic(true);
this._initLoginLogic();
},
componentWillUnmount: function() {
@ -142,7 +138,7 @@ export default createReactClass({
newProps.serverConfig.isUrl === this.props.serverConfig.isUrl) return;
// Ensure that we end up actually logging in to the right place
this._initLoginLogic(false, newProps.serverConfig.hsUrl, newProps.serverConfig.isUrl);
this._initLoginLogic(newProps.serverConfig.hsUrl, newProps.serverConfig.isUrl);
},
onPasswordLoginError: function(errorText) {
@ -346,12 +342,12 @@ export default createReactClass({
onTryRegisterClick: function(ev) {
const step = this._getCurrentFlowStep();
if (SSO_FLOWS.includes(step)) {
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 = step === 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
@ -373,7 +369,7 @@ export default createReactClass({
});
},
_initLoginLogic: async function(initial, hsUrl, isUrl) {
_initLoginLogic: async function(hsUrl, isUrl) {
hsUrl = hsUrl || this.props.serverConfig.hsUrl;
isUrl = isUrl || this.props.serverConfig.isUrl;
@ -433,14 +429,6 @@ export default createReactClass({
continue;
}
// if this is the initial render and the flow we choose is SSO/CAS then go to it automatically
// we do not do this when the user has changed to the server manually as that may be jarring.
// Only allow it when disable_custom_urls is asserted so that we don't prevent user from changing HS URL
if (initial && SdkConfig.get()['disable_custom_urls'] && SSO_FLOWS.includes(flows[i].type)) {
const tmpCli = this._loginLogic.createTemporaryClient();
PlatformPeg.get().startSingleSignOn(tmpCli, flows[i].type === M_LOGIN_SSO ? "sso": "cas", true);
}
// 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).

View file

@ -19,6 +19,10 @@ import * as sdk from '../../../index';
import SdkConfig from '../../../SdkConfig';
import AuthPage from "./AuthPage";
import * as Matrix from "matrix-js-sdk";
import {_td} from "../../../languageHandler";
// translatable strings for Welcome pages
_td("Sign in with SSO");
export default class Welcome extends React.PureComponent {
render() {