ASDSO Dam Safety Toolbox

Log out: Difference between revisions

From ASDSO Dam Safety Toolbox
Jump to: navigation, search
No edit summary
No edit summary
 
(11 intermediate revisions by 2 users not shown)
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>
     <button type="button" onclick="logOut()"
     <button type="button" onclick="logOut()" class="button"
      class="button"
       style="color: #fff;
       style="color: #fff;
       background-color: #36c;
       background-color: #36c;
Line 14: Line 13:
       min-height: 35px;
       min-height: 35px;
       text-decoration: none;">Submit</button>
       text-decoration: none;">Submit</button>
    <!-- <form method="post">
      <input type="submit" name="impexiumLogout" class="button" value="Submit"
              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;" />
    </form> -->
   </div>
   </div>
   <div id="logoutSuccess" style="visibility: hidden;">
   <div id="logoutSuccess" style="visibility: hidden;">
     <p><strong>You are now logged out and will be redirected to the <a href="https://asdso.mpxstage.com">Main site</a> in a few seconds.</strong></p>
     <p><strong>You are now logged out and will be redirected to the <a href="https://portal.damsafety.org">ASDSO Dam Safety Portal</a> in a few seconds.</strong></p>
  </div>
    <!-- TODO: if we can figure out how to redirect from Impexium site use this instead of the above -->
  <div id="logoutSuccess_NotUsing" style="visibility: hidden;">
     <!-- <p><strong>You are now logged out.</strong></p>
     <p><strong>You are now logged out.</strong></p>
     <p>Return to <a id="redirectUrl" href="/wiki/Main_Page">Main Page</a></p> -->
     <p>Return to <a id="redirectUrl" href="/wiki/Main_Page">Main Page</a></p>
   </div>
   </div>


   <script>
   <script>
     function onLoad(){
     function setRedirects(){
       var previousUrl = document.referrer;
       var previousUrl = document.referrer;
       if (!previousUrl || previousUrl !== "") {
       if (!previousUrl || previousUrl !== "") {
Line 46: Line 30:
       }
       }
     }
     }
function getCookie(cname) {
  let name = cname + "=";
  let ca = document.cookie.split(';');
  for(let i = 0; i < ca.length; i++) {
    let c = ca[i];
    while (c.charAt(0) == ' ') {
      c = c.substring(1);
    }
    if (c.indexOf(name) == 0) {
      return c.substring(name.length, c.length);
    }
  }
  return "";
}


     function logOut() {
     function logOut() {
console.log(getCookie('remoteUserEmail'));
       // Clear cookie by setting the expiration date to one day ago
       // Clear cookie by setting the expiration date to one hour ago
       var myDate = new Date();
       const d = new Date();
       myDate.setDate(myDate.getDate()-1);
       d.setTime(d.getTime()-3600);
       document.cookie = "remoteUserEmail='';expires=" + myDate + ";domain=damtoolbox.org;path=/;secure";
      console.log(d.toUTCString());
 
       document.cookie = "remoteUserEmail=; expires="+ d.toUTCString() + "; path=/;";


       // Navigate to Impexium site and logout there
       // Navigate to Impexium site and logout there
       setTimeout(function() {
       setTimeout(function() {
         //window.location.href = 'https://asdso.mpxstage.com/account/logout.aspx';
         window.location.href = 'https://portal.damsafety.org/account/logout.aspx';
       }, 3000);
       }, 3000);


Line 81: Line 48:
       y.style.visibility = "visible";
       y.style.visibility = "visible";
     }
     }
     onLoad();
 
     //TODO: if we can figure out how to redirect from Impexium site use this
    //setRedirects();
   </script>
   </script>
</html>
</html>

Latest revision as of 12:52, 2 May 2023

Do you want to log out?