Skip to first unread message

Kj kim

unread,
Feb 19, 2016, 3:14:35 AM2/19/16
to MIT App Inventor Forum
Hi,

I have been working on an app project that utilizes simple TinyDB function which allows user to sign up and login to the app, but then I hit a wall because so far I couldn't find a simple way (beginner level) to add a retrieve forgot password function without going through lengthy coding and block buildings. Could anyone point me to the right direction where there is a easy way to do this?

Thank you!

Ghica

unread,
Feb 19, 2016, 3:54:58 AM2/19/16
to MIT App Inventor Forum
Retrieving a password requires some kind of verification, otherwise it is no use to have a password. And however way you turn this around, it requires code.
In your case, since it is a local password, the danger is that someone steals your phone and uses your app. How big is that danger? How valuable are the data in your app?
Do you keep the data and the password encrypted? Otherwise it may be possible to find the data using a file explorer.

Well, the most common way to allow a user to retrieve a password, or usually to create a new one, because in good systems the password is not stored unencrypted, is to send an email to the user. You need to have stored the email address of the user in your TinyDB of course. Search this forum for pointers on how to send an email.

Another way is to have a security question, like what is the birthday of your mother or the name of your favorite cat. If the user can answer this, then you show the password. This can be fairly simple and maybe that is enough for your purpose. You can have a list of pre-set questions, of which the user can choose one. You have to store the question chosen and its answer in the TinyDB. A good exercise in list handling!

Cheers, Ghica.

Kj kim

unread,
Feb 19, 2016, 10:26:27 PM2/19/16
to MIT App Inventor Forum
Hi Ghica,

Thanks for the help, it's a very helpful answer!

Best regards,
KJ

Kj kim

unread,
Feb 20, 2016, 7:42:12 AM2/20/16
to MIT App Inventor Forum
Hi Ghica,

I have a quick question, after your advise I went back to AI to adjust the two corresponding pages, which I did on registration page (pic no.1) where I store the text value in TinyDB, but then when I tried to test it out on other page (forgot password page) by retrieve the password, it doesn't seem to work and I hope to understand what went wrong with my blocks (on pic no.2), Could you kindly help? Many thanks!

Best regards,
KJ
1.jpg
2.jpg

Ghica

unread,
Feb 20, 2016, 9:26:16 AM2/20/16
to MIT App Inventor Forum
Hi KJ,
Looking at your blocks, I think there is some confusion at what the correct process should be.
First some general remarks:
1. A tinyDB tag with the tagname " " is not a good idea.
2. Never open Screen1 from another screen, just close the other screen. Otherwise you will get memory and other problems.

Since you have decided for the security question, what should the process be?
First of all, you should have a tag in your TinyDB that indicates whether registration of the user has been done. 
If not, open the registration page, Which shows the listpicker, as you already do I think.
If the user clicks submit, you should store his/her choice of question, and also the answer, easiest using two tags, for example "questionIndex" and "questionAnswer".
Of course the user should also set the password and you should store that also in the TinyDB when he/she submits. 
Do a test for a blank password and security question answer, and do not go back if either is the case.

Then, I am not sure what you are trying to do with the password. Why are you passing it back to screen1? If it is in the TinyDB, you can also retrieve it there. Do you have a separate Login screen?
Cheers, Ghica. 

Kj kim

unread,
Feb 21, 2016, 11:01:20 PM2/21/16
to MIT App Inventor Forum
Hi Ghica,
 
For no.2, I see, if never open screen1 from another screen, what's the options for user to go back to the main page whatever they want to??
 
For your third question, I kinda understand your idea nad mechanism of that solution, but unfortunately I am a very visual person as my background is coming from graphic design field, so doing this is brand new experience to me and won't know what step shoudl I stake first. For this project, I mostly self taught by going to Youtube and online but so far I couldn't find the best way to do this with TinyDB without any screen cap out there showing the solution you just  taked about, like a overview of the block construction.
 
For the last question, passing back to screen1 is because Screen 1 is my login page. I created a login in page (screen1), registration page and retrive forgot password page, so that once users either forget their passwrod or after they register with the username/password, they can go back to Screen1 to login.
 
Thanks
KJ

Ghica

unread,
Feb 22, 2016, 3:26:03 PM2/22/16
to MIT App Inventor Forum
Read this: http://puravidaapps.com/manager.php
Basically, you can use: when yourScreenName BackPressed close screen

Cheers, Ghics.

Kj kim

unread,
Feb 22, 2016, 4:20:41 PM2/22/16
to MIT App Inventor Forum
Thank you Ghica, always been so helpful.
 
Regards,
KJ
Reply all
Reply to author
Forward
0 new messages