CryptoJones

reset.html

May 15th, 2020
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2.  
  3. <head>
  4.     <link href="" rel="stylesheet" type="text/css" title="Layout">
  5. </head>
  6.  
  7. <body>
  8.     <form id="password-reset-form" method="get">
  9.         <table class="logindisp" style="max-width:80%;" cellspacing="15" align="center">
  10.             <tr>
  11.             </tr>
  12.             <tr>
  13.                 <td class="detail4" style="white-space:nowrap;">
  14.                     <span>Dealer Number</span>
  15.                     <input placeholder="dealer number" id="CompanyNumber" type="text" class="iteminput" value="" size="0" style="font-size:18px;border-color:;" autofocus />
  16.                 </td>
  17.             </tr>
  18.             <br />
  19.             <br />
  20.             <tr>
  21.                 <td class="detail4" style="white-space:nowrap;">
  22.                     <span>New Password</span>
  23.                     <input placeholder="password" id="Password" type="text" class="iteminput" value="" size="0" style="font-size:18px;border-color:;" autofocus />
  24.                 </td>
  25.             </tr>
  26.             <br />
  27.             <br />
  28.             <tr>
  29.                 <td class="detail4" style="white-space:nowrap;">
  30.                     <span>New Password</span>
  31.                     <input placeholder="retype password" id="PasswordConfirmation" type="text" class="iteminput" value="" size="0" style="font-size:18px;border-color:;" autofocus />
  32.                 </td>
  33.             </tr>
  34.             <br />
  35.             <br />
  36.             <tr>
  37.                 <td colspan="3" class="buttoncell" style="padding-top:15px;">
  38.                     <input id="submit-button" type="button" name="submit" value="Reset Password" class="newbutton" style="font-size:18px; margin-left:100px;" />
  39.                 </td>
  40.             </tr>
  41.         </table>
  42.     </form>
  43.     <script>
  44.         document.getElementById("submit-button").addEventListener("click", async function resetpassword() {
  45.  
  46.             const myCompanyNumber = document.querySelector('#CompanyNumber');
  47.             const myPassword = document.querySelector('#Password');
  48.             const myPasswordConfirmation = document.querySelector('#PasswordConfirmation');
  49.             var myAuthKey = "{0}";
  50.             var url = "";
  51.  
  52.             const currentURL = window.location.href;
  53.  
  54.             // this is to handle what enviornment the request is coming from
  55.             if (currentURL.includes("localhost")) {
  56.                 url = "https://localhost:44392/v3/submitreset"
  57.             }
  58.             else if (currentURL.includes("c:")) {
  59.                 url = "https://localhost:44392/v3/submitreset"
  60.             }
  61.             else if (currentURL.includes("127.0.0.1")) {
  62.                 url = "https://localhost:44392/v3/submitreset"
  63.             }
  64.             else if (currentURL.includes("api.reinke.com")) {
  65.                 url = "https://api.reinke.com/v3/submitreset"
  66.             }
  67.             else {
  68.                 url = "https://api-beta.reinke.com/v3/submitreset"
  69.             };
  70.  
  71.             console.log(url);
  72.  
  73.             // define object to be JSONified
  74.             const formdata = {
  75.                 AuthKey: myAuthKey.valueOf(),
  76.                 DealerNumber: myCompanyNumber.value,
  77.                 Password: myPassword.value,
  78.                 PasswordConfirmation: myPasswordConfirmation.value
  79.             };
  80.  
  81.             // Creating a XHR object
  82.             const http = new XMLHttpRequest();
  83.  
  84.             // open a connection asynchronously
  85.             http.open("POST", url, true);
  86.  
  87.             // Set the request header i.e. which type of content you are sending
  88.             http.setRequestHeader("Content-type", "application/json");
  89.  
  90.             // Convert Object data to JSON and throw it in a string
  91.             const data = JSON.stringify(formdata);
  92.  
  93.             // Get the response from the API endpoint
  94.             http.onreadystatechange = function () {
  95.                 if (http.readyState == 4 && http.status == 200) {
  96.                     alert(http.responseText);
  97.                 }
  98.             };
  99.  
  100.             http.send(data);
  101.  
  102.  
  103.         });
  104.     </script>
  105. </body>
  106.  
  107. </html>
Add Comment
Please, Sign In to add comment