/* From Matt Bellew @ LabKey, recommended way to login via api June 2017 */

function chkRemember(){
    // examine cookies to determine if user wants the email pre-populated on form
    var h = document.getElementById('email');
    if (h && LABKEY.Utils.getCookie("email")) {
        h.value = decodeURIComponent(LABKEY.Utils.getCookie("email"));
    };

    h = document.getElementById('remember');
    if (h && LABKEY.Utils.getCookie("email")) {
        h.checked = true;
    } else {
        h.checked = false;
    };
}

function newLogin(){
    if(document.getElementById('remember').checked == true){
        LABKEY.Utils.setCookie('email', encodeURIComponent(document.getElementById('email').value), true, 360);
    } else {
        LABKEY.Utils.deleteCookie('email', true);
    }

    LABKEY.Ajax.request({
        url: LABKEY.ActionURL.buildURL('login', 'loginApi.api', this.containerPath),
        method: 'POST',
        params: {
            remember: document.getElementById('remember').value,
            email: document.getElementById('email').value,
            password: document.getElementById('password').value,
            returnUrl: LABKEY.ActionURL.getParameter("returnUrl"),
        },
        success: LABKEY.Utils.getCallbackWrapper(function (response) {
            if(response && response.returnUrl){
                window.location = response.returnUrl;
            }
        }, this),
        failure: LABKEY.Utils.getCallbackWrapper(function (response) {
            if(document.getElementById('errors') && response && response.exception) {
                // Want special point to password reset not given by LK response
                if(response.exception.includes('did not match')){
                    document.getElementById('errors').innerHTML = 'Invalid Username or Password.<br> You can reset your password via the question mark link above.';
                } else {
                    document.getElementById('errors').innerHTML = response.exception;
                }
            }
            if(response && response.returnUrl){
                window.location = response.returnUrl;
            }
        }, this)
    });
}

@@ -1135,16 +1135,19 @@
         
+ //
  returnU
@@ -1194,16 +1194,16 @@
 nUrl%22),%0A
-
         
@@ -1279,32 +1279,35 @@
 e) %7B%0A           
+ //
  if(response && 
@@ -1331,36 +1331,39 @@
 l)%7B%0A            
+//
     
+ 
 window.location 
@@ -1388,33 +1388,106 @@
 rl;%0A            
-%7D
+// %7D%0A            LABKEY.ActionURL.buildURL('project', 'begin', '/Studies')
 %0A        %7D, this
@@ -2104,32 +2104,35 @@
    %7D%0A           
+ //
  if(response && 
@@ -2164,20 +2164,23 @@
         
+//
     
+ 
 window.l
@@ -2213,33 +2213,106 @@
 rl;%0A            
-%7D
+// %7D%0A            LABKEY.ActionURL.buildURL('project', 'begin', '/Studies')
 %0A        %7D, this

change welcome page to Studies/begin.view?