Incorporate review

pull/7152/head
Brendan Abolivier 2020-03-27 12:15:46 +01:00
parent adb38c0aa9
commit 45409c2ef3
No known key found for this signature in database
GPG Key ID: 1E015C145F1916CD
1 changed files with 9 additions and 13 deletions

View File

@ -52,23 +52,19 @@ var show_login = function() {
var this_page = window.location.origin + window.location.pathname; var this_page = window.location.origin + window.location.pathname;
$("#sso_redirect_url").val(this_page); $("#sso_redirect_url").val(this_page);
if (matrixLogin.serverAcceptsCas) { if (matrixLogin.serverAcceptsSso) {
$("#sso_form").attr("action", "/_matrix/client/r0/login/cas/redirect"); if (try_token() || matrixLogin.serverAcceptsPassword) {
} // Show the SSO form if there's a login token in the query. That's because,
// if there is a token, and this function is run, it means an error happened,
if ((matrixLogin.serverAcceptsSso || matrixLogin.serverAcceptsCas)) { // and in this case it's nicer to show the form with an error rather than
if (try_token()) { // redirect immediately to the SSO portal.
// Only show the SSO form if there's a login token in the query. That's // Also show the form if the server is accepting password login as well.
// because, if there is a token, and this function is run, it means an error
// happened, and in this case it's nicer to show the form with an error
// rather than redirect immediately to the SSO portal.
$("#sso_form").show(); $("#sso_form").show();
} else { } else {
// Submit the SSO form instead of displaying it. The reason behind this // Submit the SSO form instead of displaying it. The reason behind this
// behaviour is that the user will likely arrive here after clicking on a // behaviour is that the user will likely arrive here after clicking on a
// button, in the client, with a label such as "Continue with SSO". And even // button, in the client, with a label such as "Continue with SSO", so
// if that's not the case, it kind of makes sense to direct the user directly // clicking on another button with the same semantics is a bit pointless.
// to the SSO portal and skip the password login form.
$("#sso_form").submit(); $("#sso_form").submit();
return; return;
} }