B4J Question [ABMaterial] how to implement"remember me" function

Cableguy

Expert
Licensed User
Longtime User
Hi gurus

In my ABM webapp, I have a register/login DataBase driven functionality. I would like to provide my users a "remember me" feature... but I have no clue how to go about it.
Should I retrieve user IP address and save it on the database?
 

mindful

Active Member
Licensed User
Hi gurus

In my ABM webapp, I have a register/login DataBase driven functionality. I would like to provide my users a "remember me" feature... but I have no clue how to go about it.
Should I retrieve user IP address and save it on the database?
You should use cookies to store that the user is authed (best to issue a toked/id that you pair with your logged user and verifity it) or use the session attributes to store that the user has logged in successfully. By using a cookie you can set an expire date for that cookie and by using session attributes they will be cleared if the session expires or the server is restarted ....

You can check the abmaterial demo project as it uses session attributes (i am not at the pc right now but it was something like NeedsAuthorization) ...
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
B4X:
Page.CookieSet("test", "testvalue", "expires: '01/01/2017'") ' set the cookie
Log(Page.CookieGet("test")) ' get the cookie
Page.CookieExpire("test", "") ' remove the cookie

Make sure you set/get your Cookie AFTER ABMPageId = ABM.GetPageID(page, Name,ws)

If you do it BEFORE, the websocket is not attached to the page yet and will skip the command

As for the session, see the source code of the Feedback App.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…