Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Show disclamier for first time login

I have followed this tutorial (http://devcenter.appery.io/tutorials/...) to successfully build a login page. No sign up, only log in. Once the user login, the App will navigate to the home page. However, I need to improve this such that, for first time login a "disclaimer" will pop up (or go to special page) and give the user two options:
1) Agree: The App will navigate to the home page
2) No: The App will go back to login page.

I agree that the button Agree will navigate to home page and the button No will navigate to login page. But how to identify if this login is first time or not? Many thanks for your help

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Show disclamier for first time login

Hi Hawk,

You can set a localStorage variable on log-in action, and don't display a popup if it it already set.

Kristof de Block
Posts: 0
Joined: Tue Aug 05, 2014 4:01 pm

Show disclamier for first time login

Do you have any example?

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Show disclamier for first time login

Hi

I added the following JS to login/success service:

if (localStorage.getItem("accepted") !== "true"){ Apperyio.navigateTo("Disclaimer");}
else {Apperyio.navigateTo("pg2_HomePage");}

In login_page/load event, I defined the localStorage :

var accept, result;
accept = result;

The dialog "Disclaimer" shows after I login. There are two options (I Agree, NO). For Agree button, I added on click:

result = true;
Apperyio.navigateTo("pg2_HomePage");

The problem is when I logout and login again, it still shows the disclaimer. Which I guess because the var accept is always being defined again with every login_page load. Is my logic correct? How can i fix this? Thank you for your help

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Show disclamier for first time login

Hello Hawk,

You also should keep the result value in localStorage
ie
preresult = true;
localStorage.setItem("accepted", result);
Apperyio.navigateTo("pg2_HomePage");/pre

Return to “Issues”