Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

make app only accessible by logged in users

Create JS asset with the following code pre$(document).on("pageshow", "[data-role=page]", function(){
if ($(this).attr("dsid") !== "loginPageName" && !localStorage.getItem("userId")) {
Appery.navigateTo('loginPageName');
}
});/preHere on Show event of any page we check if userId localStorage is not set and we're not on loginPageName page, then navigate to loginPageName page. Replace this name with your page name.

2) On logout service success event refresh userId localStorage variable (before navigating to login page)

PTR
Posts: 0
Joined: Fri Feb 07, 2014 2:07 pm

make app only accessible by logged in users

Its working great!

Thx for all the help, i am so happy by the service and support you provide. Thank you!!

Return to “Issues”