Page 1 of 1

Show disclamier for first time login

Posted: Tue Aug 19, 2014 9:32 am
by Hawk

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


Show disclamier for first time login

Posted: Tue Aug 19, 2014 11:16 am
by Kateryna Grynko

Hi Hawk,

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


Show disclamier for first time login

Posted: Tue Aug 19, 2014 2:59 pm
by Kristof de Block

Do you have any example?


Show disclamier for first time login

Posted: Tue Aug 19, 2014 5:50 pm
by Evgene Karachevtsev

Kristof,

This link should help: https://getsatisfaction.com/apperyio/...


Show disclamier for first time login

Posted: Wed Aug 20, 2014 5:43 am
by Hawk

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


Show disclamier for first time login

Posted: Wed Aug 20, 2014 3:29 pm
by Evgene Karachevtsev

Hello Hawk,

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