Login session for dummies

This forum allows developers to post programming tips and coding techniques that may be useful to other Visual LANSA developers. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
wizard
Posts: 10
Joined: Thu Aug 25, 2016 12:48 pm

Login session for dummies

Post by wizard »

Hello everyone :D

I am new in Lansa environment. I came from php programmer and currently working on Lansa Web Dev Tools.

As you guys know it is so simple to do login function in php. I mean, we create a database, a table named 'registrationtbl', put some data, then develop a login UI, user key in username and password, the system will check does the input are on database, if does the user will login then the session will start.

I wonder how to do it on VL. I have do the tutorial about session but the input is only 'LANSA', not from database. I wonder how to do login session and validation just like php can do.

I noticed that people said VL will make web dev process easier but there not so much source newcomer like me to depend on. So i found this forum and really hope you guys can be our teacher.

Thank you in advance. The simplest way the better :) ;)

Regards, Wizard
blaynec
Posts: 7
Joined: Wed Dec 09, 2015 3:55 am

Re: Login session for dummies

Post by blaynec »

wizard - did you find the answer to your question about logging in using a database?

I recently started with VL Web as well. I agree that the documentation for VL Web doesn't really exist yet.
What worked best for me was to start in the Lansa IDE and click "File | New" and create a new Web Page from a Lansa Template - like the "Application Layout". That gave me a sample application that I could play around with and figure out how things worked.
Then change the code in the Server Module to check a database for the username and password.

Basic parts you need for a simple login page:
+ Web Page - this is where you put your design/layout. Don't put business logic here.
+ Reusable Part - Put your login form in here; including calls to the server module.
+ Server Module - This is the object that runs on the server and provides services to your reusable parts and web pages. This is where you'd put the login logic, like checking a database. Also, after successful authentication your server module would start the session. Make sure to use "SessionKeyMethod(Cookie)" - since it's not the default and will work like you'd expect a session to work in php.


If you'd like more I have some diagrams and sample code that might help.
Post Reply