Komodo / KomodoEdit

Komodo Edit is a fast and free multi-language code editor. Written in JS, Python, C++ and based on the Mozilla platform.
http://www.komodoide.com/komodo-edit
Other
2.14k stars 299 forks source link

Komodo SSO signin is broken #3878

Open th3coop opened 4 years ago

th3coop commented 4 years ago

Short Summary

You can't login to Collaboration any more. There's no error. It just response with nothing.

Here's some gross, hacked together test code:

let email = "username";
let pw = "blah";
ssoLoginURL = ""; // Look at sso.js to piece together this url
console.log("Logging in");
let makeRequest = (url, method, post, successCallback, errorCallback) => {
    console.log("post");
    console.log(post);
    console.log("url");
    console.log(url);
    console.log("method");
    console.log(method);
    var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
                        .createInstance(Components.interfaces.nsIXMLHttpRequest);
    if (req) {
        var callback = function makeRequest_callback() {
            if (req.readyState == 4) {
                if (req.status >= 200 && req.status < 300)
                    successCallback();
                else
                    errorCallback();
            }
        };
        req.onreadystatechange = callback;
        req.open(method, url, true);
        if (post) {
            req.setRequestHeader("Content-type",
                                 "application/x-www-form-urlencoded");
            req.setRequestHeader("Content-length", post.length);
        }
        req.send(post);
    }
    return req;
};

var onLoginSuccess = function() {
    let resp;
    let req;
    try {
        resp = JSON.parse(req.responseText);
    } catch(e) {
        console.error('Error parsing login response');
        console.error(e);
        return;
    }
    if (!(resp.hasOwnProperty('sessionKey') && resp.hasOwnProperty('userId'))) {
        console.error('Invalid server response during SSO login!');
        return;
    }
    console.log("resp");
    console.log(resp);
    console.log("login successful");
}

var onLoginError = function() {
    console.log("req");
    console.log(req);
    console.log("login FAILED");
}

var credentials = 'email=' + encodeURIComponent(email) +
              '&password=' + encodeURIComponent(pw);
req = makeRequest(ssoLoginURL, 'POST', credentials,
                        onLoginSuccess,
                        onLoginError);