ASDSO Dam Safety Toolbox

Log out: Difference between revisions

From ASDSO Dam Safety Toolbox
Jump to: navigation, search
No edit summary
No edit summary
Line 2: Line 2:
   <div id="confirmLogout">
   <div id="confirmLogout">
     <p>Do you want to log out?</p>
     <p>Do you want to log out?</p>
     <form method="post">
     <button type="button" onclick="logOut()"
      class="button"
      style="color: #fff;
      background-color: #36c;
      cursor: pointer;
      padding: 5px 12px;
      line-height: 1;
      border: 1px solid #36c;
      border-radius: 2px;
      transition: background-color 100ms,color 100ms,border-color 100ms,box-shadow 100ms;
      min-height: 35px;
      text-decoration: none;">Submit</button>
 
    <input type="button" onclick="logOut()"
      class="button"
      style="color: #fff;
      background-color: #36c;
      cursor: pointer;
      padding: 5px 12px;
      line-height: 1;
      border: 1px solid #36c;
      border-radius: 2px;
      transition: background-color 100ms,color 100ms,border-color 100ms,box-shadow 100ms;
      min-height: 35px;
      text-decoration: none;">Submit</input>
 
 
 
    <!-- <form method="post">
       <input type="submit" name="impexiumLogout" class="button" value="Submit"
       <input type="submit" name="impexiumLogout" class="button" value="Submit"
               style="color: #fff;
               style="color: #fff;
Line 14: Line 42:
               min-height: 35px;
               min-height: 35px;
               text-decoration: none;" />
               text-decoration: none;" />
     </form>
     </form> -->
   </div>
   </div>
   <div id="logoutSuccess" style="display:none;">
   <div id="logoutSuccess" style="visibility: hidden;">
     <p><strong>You are now logged out.</strong></p>
     <p><strong>You are now logged out.</strong></p>
     <p>Note that some pages may continue to be displayed as if you are still logged in, until you clear your browser cache.</p>
     <p>Note that some pages may continue to be displayed as if you are still logged in, until you clear your browser cache.</p>
     <p>Return to <a href="">Page Name</a></p>
     <p>Return to <a href="">Page Name</a></p>
   </div>
   </div>
  <script>
    function setCookie(cname, cvalue, exdays) {
      const d = new Date();
      d.setTime(d.getTime() + (exdays*24*60*60*1000));
      let expires = "expires="+ d.toUTCString();
      document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
      console.log('Set Cookie');
      console.log(cname + "=" + cvalue + ";" + expires + ";path=/");
    }
    function logOut() {
      // Clear cookie by setting the expiration date to one hour ago
      console.log('Clear cookie');
      //document.cookie = "remoteUserEmail=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
      setCookie('remoteUserEmail', '', -1);
      // Navigate to Impexium site and logout there
      console.log('Navigate to Impexium site and logout there');
      // Simulate a mouse click:
      window.location.href = 'https://asdso.mpxstage.com/account/logout.aspx';
      // Simulate an HTTP redirect:
      //window.location.replace('https://asdso.mpxstage.com/account/logout.aspx');
      console.log('FINISH Show confirmation');
      var x = document.getElementById("confirmLogout");
      x.style.display = "none";
      var y = document.getElementById("logoutSuccess");
      y.style.display = "block";
      // TODO: FINISH Show confirmation
      //echo '<style type="text/css">#confirmLogout{ visibility: hidden; } #logoutSuccess{ visibility: visible; }</style>';
    }
  </script>
</html>
</html>

Revision as of 19:48, 17 April 2023

Do you want to log out?

Submit