project BLF > class Session > method Login
Description
To log in to the application, using a user login and password.
All business functions require a valid login (represented by the instance ID of the session that contains the login) to be able to run.
Parameters
| icLogin | input | character | Login id that should be checked for validity. |
| icPassword | input | character | Password of the user that needs to be validated |
| icExtra | input | character | Extra information that might be needed to validate the user/password. |
| olValid | output | logical | Valid login ? |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
program code (program1/session.p)
if lookup("CompanyCode":U, icExtra, chr(2)) = 0
and icLogin <> ""
and icLogin <> ?
then do:
<Q-2 run UsrDefaultDomainCompany (all) (Read) (NoCache)
(input 0, (UsrID)
input icLogin, (UsrLogin)
output dataset tqUsrDefaultDomainCompany) in BUser>
find first tqUsrDefaultDomainCompany
no-error.
if available tqUsrDefaultDomainCompany
then assign icExtra = icExtra + chr(2) + "CompanyCode":U + chr(2) + tqUsrDefaultDomainCompany.tcCompanyCode.
else do:
/* no default ? take a random */
<Q-86 run UserCompanies (all) (Read) (NoCache)
(input icLogin, (UserLogin)
input 0, (CyId)
input 0, (DomainId)
output dataset tqUserCompanies) in BUser>
find first tqUserCompanies no-error.
if available tqUserCompanies
then assign icExtra = icExtra + chr(2) + "CompanyCode":U + chr(2) + tqUserCompanies.tcCompanyCode.
empty temp-table tqUserCompanies.
end.
empty temp-table tqUsrDefaultDomainCompany.
end.
assign vlDoLogOut = true.
<M-18 run SetDebug
(input icExtra (icExtra),
output viFcReturnSuper (oiReturnStatus)) in Session>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
<M-13 run CheckLogin
(input icLogin (icLogin),
input icPassword (icPassword),
input icExtra (icExtra),
output vlValid (olValid),
output viFcReturnSuper (oiReturnStatus)) in Session>
assign vlLoginFailed = not vlValid or viFcReturnSuper < 0.
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
/* Clear cache of previous login */
<M-20 run StartCacher
(output vhFcComponent (ohCacher),
output viFcReturnSuper (oiReturnStatus)) in Session>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
<M-21 run ClearCache
(output viFcReturnSuper (oiReturnStatus)) in Cacher>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
if not vlLoginFailed
then do:
<M-22 run SetCharacterValue
(input 'UserLogin':U (icName),
input icLogin (icValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
<M-19 run ApplicationLogin
(input vcGlobalSessionId (icGlobalSessionId),
input vcTmpCompCode (icCompanyCode),
input icExtra (icExtra),
input no (ilReturnTimeStamps),
output vcFcMaskList (ocReportTimeStamp),
output vcDummyC (ocSystCacheDateTime),
output vcDummyS (ocSystDateTime),
output viFcReturnSuper (oiReturnStatus)) in Session>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
end.
assign olValid = true.
<M-1 run SetLogicalValue
(input 'ValidLogin':U (icName),
input olValid (ilValue),
output viFcReturnSuper (oiReturnStatus)) in Session>