Changeset 2160


Ignore:
Timestamp:
Jul 15, 2016, 10:01:41 AM (3 years ago)
Author:
kbut
Message:

Add fucntion to redirect to login if session is wrong

Location:
admin-center/trunk/fuentes/admin-center.install/usr/share/admin-center
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • admin-center/trunk/fuentes/admin-center.install/usr/share/admin-center/js/main.js

    r2002 r2160  
    289289}
    290290
     291AdminCenter.prototype.cleanSession = function cleanSession(){
     292        if(sessionStorage.hasOwnProperty('server')){
     293      sessionStorage.removeItem('server');
     294    }
     295    if(sessionStorage.hasOwnProperty('password')){
     296      sessionStorage.removeItem('password');
     297    }
     298    if(sessionStorage.hasOwnProperty('username')){
     299      sessionStorage.removeItem('username');
     300    }
     301}
     302
     303AdminCenter.prototype.sessionIsCorrectly = function sessionIsCorrectly(){
     304        if (!sessionStorage.hasOwnProperty('server') || !sessionStorage.hasOwnProperty('password') || !sessionStorage.hasOwnProperty('username')){
     305                return false;
     306        }
     307        else{
     308                return true;
     309        }
     310}
     311
     312
    291313$(document).ready(function() {
    292314  admin_center=new AdminCenter();
    293 
     315  if (!admin_center.sessionIsCorrectly()){
     316        window.location="login.php";
     317  }
     318 
    294319  $("#bt_logout").bind("click", function(){
    295     sessionStorage.server="";
     320    admin_center.cleanSession();
    296321    window.location="login.php";
    297322  });
  • admin-center/trunk/fuentes/admin-center.install/usr/share/admin-center/main.php

    r2115 r2160  
    2020echo ("<div id='snack' data-toggle='snackbar' data-html-allowed='true' data-content=''></div>   ");
    2121
     22
     23importCommonLibraries();
     24importCommonScripts();
    2225echo ("</body>");
    2326echo ("</html>");
    24 
    25 importCommonLibraries();
    26 importCommonScripts();
    2727
    2828/*  Main Functions  */
Note: See TracChangeset for help on using the changeset viewer.