Skip to Content
Author's profile photo Karthik Arjun

Session Validation in WebPage and Mobile using SAPUI5

Hi all,

In View :

var btnLogout = new sap.ui.commons.button({

text : “Logout”,

press : oController.logout

});

In Controller :

logout : function(){

            window.sessionStorage.setItem(“logonapp”,”N”); // logonapp – key , N – value

            window.open(“index.html”,”_self”); // used to open login page

}

once we pressed logout…it will go to first index page now…if user Click on back arrow button in browser it will go to the previous page (where we put logout button).

so that only we are using this session validation…once user clicked logout buttonit will never go to the previous page without giving user id and password…

In Controller :

onInit: function() {

                   

                          if(window.sessionStorage.getItem(“logonapp”) == “N”) {

                           alert(“User logged out. Please login again…”);

                         window.open(“index.html”,”_self”);

                          }

                         },



once we put this code in init…it wont allow user to go previous page without giving user name password once again…………………………………………

Thanks,

Karthik A

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.