Page 1 of 2
Even after doing logout session is not expiring
Posted: Wed Aug 28, 2013 7:46 am
by Asif
Hi
I am firing logout service on the click of a button and then on the success of logout service i am navigating my app to login page. But after this if I press back button in my mobile its again taking me to the inside page and session also remains in the browser.
Even after doing logout session is not expiring
Posted: Wed Aug 28, 2013 10:41 am
by Maryna Brodina
Even after doing logout session is not expiring
Posted: Wed Aug 28, 2013 11:21 am
by Maryna Brodina
Could you clarify how did you configure login and logout? How did you add restriction to navigate to another page? It's not added automatically. It should be part of your app logic. Did you restrict navigating to another screen before login?
Even after doing logout session is not expiring
Posted: Wed Aug 28, 2013 11:35 am
by Asif
No we have not restricted to navigate to other screen before login.
When we perform login - we call the login service and navigate to home page based upon the response.
On logout success - we navigate back to login screen .
Is there any way to restrict the logic as you said . Please could you give us a sample.
Thanks
Even after doing logout session is not expiring
Posted: Wed Aug 28, 2013 12:14 pm
by Maryna Brodina
For example after login you can save to localStorage that user is logged in. On other pages on page Show add JS to check - if variable is not set - then navigate to login page. Reset this variable while logout.
Even after doing logout session is not expiring
Posted: Wed Aug 28, 2013 2:19 pm
by Asif
Hi
On the success of Logout service I am setting localStorate variable to null
and then on PageShow event of the page i am writting this JS
alert(localStorage.getItem('token'));
if(localStorage.getItem('token')==null || localStorage.getItem('token')=="")
{
alert("inside if ");
Appery.navigateTo('Login', {});
}
else
alert("inside else");
In the alert box i am getting token value as 'null' but still it is going in 'else'
can you pls chk!!
I have shared my project on a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a
Even after doing logout session is not expiring
Posted: Wed Aug 28, 2013 5:03 pm
by Asif
Hi
I want to alter my question::
When I do logout and press back button the application should exit.
how to achieve this..!!
Pls help because this has became a show stopper for my work.
Even after doing logout session is not expiring
Posted: Wed Aug 28, 2013 6:25 pm
by Maryna Brodina
Even after doing logout session is not expiring
Posted: Wed Aug 28, 2013 6:35 pm
by Anton Artyukh5836028
Hello,
First of all, how you setting null?
Second, is better idea remove token from localStorage
prelocalStorage.removeItem( 'token' );/pre
After this, localStorage.getItem( 'token' ) will by equals to null and no need to compare with empty string.
Even after doing logout session is not expiring
Posted: Wed Aug 28, 2013 8:29 pm
by Asif
Hi . Even after setting local storage token to null the page still fetches data from page load service .
When I reach the login screen after log out service has run the user now presses the back button on the phone , this should ideally exit the app, but instead the page navigates to the previously seen page . Please help me exit the app . The work has completed by the user ans the application needs to exit