Logging onto VLF-ONE without entering a user and password

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
MarkD
Posts: 509
Joined: Wed Dec 02, 2015 9:56 am

Logging onto VLF-ONE without entering a user and password

Post by MarkD » Mon Aug 15, 2016 9:27 am

If you are developing a VLF-ONE application then having to continuously enter your credentials can become onerous.

Here's a way to enter them automatically and avoid the log on dialog.

Create a new reusable part named MYLOGON (say).

In your custom VLF-ONE entry point form, copied from UF_OEXEC, nominate MYLOGON in the LogonHandlerId() parameter, instead of VF_AC026O.

Code: Select all

#VLF_ONE.uInitialize ……………….. LogonHandlerId(MYLOGON) ……………..………… 
Put this code into MYLOGON and change user and password where indicated ………………..

Code: Select all

Begin_Com Role(*EXTENDS #VF_AC026O)
Define_Com Class(#PRIM_TIMR) Name(#LogonShortDelayTimer) Interval(1) Startup(Manual)
* ------------------------------------------------------------
Evtroutine Handling(#LogonShortDelayTimer.Tick)
#LogonShortDelayTimer.Stop
* Replace TheUser and ThePassword with valid credentials.
Signal Event(LogOnAttemptRequested) Platformu(TheUser) Platformp(ThePassword)
Endroutine
* ------------------------------------------------------------
* Handle getting required user profile and password
Mthroutine Name(uRequestPlatformUCredentials) Options(*REDEFINE)
Define_Com Class(#Prim_Boln) Name(#AtEntry_FrameworkLoadListAttempted)
* Track what the framework list load attempt flag says at entry
#AtEntry_FrameworkLoadListAttempted := #FrameworkListLoadAttempted
* Do ancestor processing
#Com_Ancestor.uRequestPlatformUCredentials Templogonmanager(#TempLogonManager) Attemptedrequests(#AttemptedRequests)
* No log on form is to be visible
#Com_Owner.Visible := False
* If the frameworks list still needs to be loaded return control and wait for
* that to happen. When it does happen this method will be called again.
If (#AtEntry_FrameworkLoadListAttempted = False)
Return
Endif
* There is only one automatc attempt allowed otherwise bad values will get stuck in a loop
If (#AttemptedRequests > 1)
#uSystem.IssueTextMessage Text('The server has rejected your logon request. Check the user and password used.') Collectionnumber(1)
#uSystem.SignalRequestExit Possibletocancel(False) Browserisclosing(False)
Return
Endif
* If we reach here then start the log on a slight delay
#LogonShortDelayTimer.Start
Endroutine

End_Com

Post Reply