How to login

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. 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

How to login

Post by wizard » Thu Aug 25, 2016 1:44 pm

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

wizard
Posts: 10
Joined: Thu Aug 25, 2016 12:48 pm

Re: How to login

Post by wizard » Fri Aug 26, 2016 1:12 pm

So nobody willing to help. No wonder LANSA not famous. Cant even do login session. SMH. Game changer my ass.

RomainM
Posts: 18
Joined: Wed May 18, 2016 1:37 am
Location: France

Re: How to login

Post by RomainM » Fri Aug 26, 2016 5:05 pm

Hi Wizard,

I suggest to have a look on the sample application "online Banking" using the components XBNMain and XBNLogin.

regards.

MarkD
Posts: 625
Joined: Wed Dec 02, 2015 9:56 am

Re: How to login

Post by MarkD » Fri Aug 26, 2016 5:27 pm

Some people prefer to validate the VL-Web session user and password against their operating system credentials.
That might save having to give people multiple profiles and/or do dual user profile maintenance.
It might also be more secure, because normally operating system user credentials are very safely stored.
It may also allow the operating system's built in object authority model to be applied to resources that the logged on user attempts to access within their session.

appbuilder
Posts: 8
Joined: Sat Jan 16, 2016 9:53 am

Re: How to login

Post by appbuilder » Sat Aug 27, 2016 1:11 am

You might also want to look at the Samples and Examples in the IDE under Sign In or Session Handling.

nazirul_fitri
Posts: 21
Joined: Thu Sep 15, 2016 7:00 pm

Re: How to login

Post by nazirul_fitri » Thu Sep 15, 2016 7:03 pm

both of the sample 'online banking' and session 'handling' is not check the value from the database. can anyone tell me how to check the value such as username and password in database for the login..PLEASE HELPP!!

Ingmar
Posts: 3
Joined: Mon Aug 29, 2016 4:45 pm

Re: How to login

Post by Ingmar » Fri Sep 16, 2016 9:28 am

hi,

for me, creating files and reading/writing records in a file was one of the first things I learned doing Lansa.

ask your boss for some sort of basic Lansa course, if they won't do it, just follow some of the education links from the home page and do some of the examples. I found this onea bout file IO in web pages.... its pretty easy

http://docs.lansa.com/14/en/lansa095/in ... 1_0030.htm

Ingmar

nazirul_fitri
Posts: 21
Joined: Thu Sep 15, 2016 7:00 pm

Re: How to login

Post by nazirul_fitri » Mon Sep 19, 2016 12:59 pm

Ingmar wrote:hi,

for me, creating files and reading/writing records in a file was one of the first things I learned doing Lansa.

ask your boss for some sort of basic Lansa course, if they won't do it, just follow some of the education links from the home page and do some of the examples. I found this onea bout file IO in web pages.... its pretty easy

http://docs.lansa.com/14/en/lansa095/in ... 1_0030.htm

Ingmar
i have read through the tutorial you said, but i still dont get it how to do the login that read the value from database.. any tips??

User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: How to login

Post by Stewart Marshall » Mon Sep 19, 2016 2:12 pm

OK, let's start at the beginning.

Have you created a database table in LANSA to store userIDs and passwords, or do you have an existing table? If you do have an existing table, have you made it known to LANSA? i.e. Have you loaded it as an "Other" File?

Once you have the table, you can use the FETCH command in a Server Module to read a record to test the user ID and password combination.

The xDemoWebSessions example show how sessions work. This executes a SignIn routine in the server module that in turn executes the VerifyUser routine. For simplicity in the sample, this simply looks at the user. However, it could be changed very easily to access a table to test whether the user exists and whether the password is correct.

The code will look a little like this

Code: Select all

Mthroutine Name(VerifyUser) Access(*Private)
Define_Map For(*Input) Class(#Prim_alph) Name(#SuppliedUser)
Define_Map For(*Input) Class(#Prim_alph) Name(#SuppliedPassword)
Define_Map For(*Result) Class(#Prim_boln) Name(#Result)

*Read the password from the table for the supplied user ID
Fetch fields(#Password) from_file(Users) with_key(#SuppliedUser)

* If a record was returned
if_status(*okay)

* Test the password
#Result := (#Password = #SuppliedPassword)

Endif

Endroutine
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au

Post Reply