No announcement yet.

Call UserForm to Re-enter Password when Error logging in

  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Re: Call UserForm to Re-enter Password when Error logging in

    Glad you got it working in the end, and thanks for coming back to share your solution with the rest of the community!


    • #17
      Hi all,

      The code I had posted previously worked perfectly for a few years, until recently when the host page was just updated a couple weeks ago. Now I believe my authentication line doesn't work anymore. I've tried everything I can think of, but nothing gets me logged in. It's been a few years, so I can't recall where I got the line and how it was used, and sadly, I didn't explicitly say what I used in my comments in the code.

      My question:

       strAuthenticate = "username=" & Username & "&password=" & Password & "&countryLocation=US" & "&submit=+working...+" & "&jsUTCOffset=420"     '&jsUTCOffset=420 sets the time zone for my location.
      This is my old working code. Are the "username" and "password" ID tags? Or how do they get called in the html? I've tried the same username and password, and it doesn't work. I'd like to mention that the host page now has a log-in pop-up form.

      strAuthenticate = "username=" & Username & "&password=" & Password & "&onclick=return validateAndSubmit(4768);"
      This is my latest version, but I don't think I'm calling the form, or calling the submit button correctly. Here is the html for the submit button:

      HTML Code:
      <button class="btn btn-primary hid-loginPanel-btn2" type="submit" id="hidSignIn" onclick="return validateAndSubmit(4768);"><span class="hid-social-text"><span>Sign In</span></span></button>

      Can anyone advise please?

      Thank you,



      • #18
        Hi Hilary,

        In your original code the variables were being passed to the server via what's called a "GET" request, whereby the variables are displayed as part of the URL and the server picks them up from there.

        This is probably the most insecure way of passing data to a server as your details are essentially in plain sight for anyone to steal. I would like to think that part of the update involved them changing the way data is sent to a "POST" method after the data has been securely encrypted/hashed.

        If this is the case, then your code will no longer work. You will have to check the page's source code to see how the login is authenticated (I can see it's a javascript function, so probably an AJAX call somewhere) and then you will have to re-write your code to accomodate.

        Sorry it's not better news!




        • #19
          No, it has always been a POST request. Bottom of page 1 has my working code.

          WHTTP.Open "POST", mainURL, False    
          WHTTP.setRequestHeader "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"    
          WHTTP.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36"    
          WHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"    
          WHTTP.send strAuthenticate
          It is still a POST request, but I don't know how to call the the username and password. I believe it's just the ID? And then submit the authentication code.


          • #20
            Do you mean how to set the username and password for the request?

            WHTTP.setCredentials username, password, 0

            Other than that, it could be that the parameter names have been updated on the server-side code which unfortunately you will have no way of knowing unless you are comfortable using F12 developer tools to capture the network response or ask the developer(s) that updated the page.


            • #21

              I had tried that method, but it doesn't work. I had been using the developer tools to look at the response, but the javascript for the form is so complex and foreign to me that I'm having a hard time with it. The submit button returns a function, and my code doesn't seem to like that.

                  strAuthenticate = "username=" & Username & "&password=" & Password & "&appid=4768" & "&submit=return validateAndSubmit(4768);"

              function validateAndSubmit(t){var i=$.trim($("#form_"+t+" input[name=username]").val()),a=$.trim($("#form_"+t+" input[name=password]").val());return""==i?(alert("Please type your "+$("#form_"+t+" input[name=username]").attr("label")),!1):""==a?(alert("Please type your "+$("#form_"+t+" input[name=password]").attr("label")),!1):void(validateCdsUser(i)&&$("#form_"+t).submit())}var hidshowappid=getHidQueryParamValue("");HigID.prototype={constructor:HigID,render:function(){var t=this._appId,i=this._buttonImage,a=this._appName;this.buttonData=new Object,this.buttonDataPut=function(t,i){""!=i&&(this.buttonData[t]=i)},this.buttonDataPut("buttonImage",this._buttonImage),this._button?$.ajax({url:hidserver+"/services/rest/apps/"+t+"/login_button",type:"GET",data:this.buttonData,dataType:"jsonp",jsonp:"callback",crossDomain:!0,success:function(e,n,o){if("true"==e[0].success)$("#hid_"+t).css("cursor","pointer").html(e[0].html);else if("0"==e[0].appalive)if(""!=i){var s='<img style="width:188px;height:75px;padding:0;" src="'+i+'" class="img-responsive hid-loginBtn" alt="'+a+'" data-target="#hid_systemDownModal" data-toggle="modal"/>';$("#hid_"+t).css("cursor","pointer").html(s)}