A5WS_Login_User Function

Syntax

Result as P = a5ws_Login_User(C userid ,C password [,C targetpage [,* Localrequest [,* Localsession [,* Localresponse ]]]])

Arguments

Result

result.error = Will return FALSE if the login is successful. result.RedirectURL Successful Login - Will contain the name of the page set as the redirect page after login from the web security configuration. If TargetPage has a value, result.RedirectURL will have the value from TargetPage. Failed Login - Will contain the name of the page set as the "Redirect page - login" from the web security settings.

userid

A valid Userid for a user in the security system

password

A valid password for a user in clear text (not encrypted) .

targetpage

Optional. The name of a page to navigate to after a successful login. This overrides any page defined in the security settings.

Localrequest

*

Localsession

*

Localresponse

*

Description

Log in user on a web page using supplied values. Returns <pointer>.error, <pointer>.RedirectURL. If error = .F. , RedirectURL will contain the target page. If error = .T., it will return the login redirect page.

Discussion

The A5WS_Login_User() will login a user using the web security system. the UserID and Password must match the values saved in the security system for a valid user. If the login suceeds, Result.Error will return 'FALSE' and Result.RedirectURL will contain name of the page set as the "Redirect page after login" from the web the security settings . If TargetPage has a value, result.RedirectURL will have the value from TargetPage. If the login fails, Result.Error will return 'TRUE' and Result.RedirectURL will contain the page designated in the security settings as the "Redirect page - Login".

Example

The following example attempts to login a user with a UserID = "[email protected]" and a password = "Password". This user does NOT exist in the system. The page designated as the login page in the security configuration is "login.a5w"

dim pResult as p
pResult = a5ws_Login_User("[email protected]","Password")
?pResult
= error = .T.
RedirectURL = "login.a5w"

The following example attempts to login a user with a UserID = "[email protected]" and a password = "Password". This user DOES exist in the system. A TargetPage is supplied.

dim pResult as p
pResult = a5ws_Login_User("[email protected]","Password","administration.a5w")
?pResult
= error = .F.
RedirectURL = "administration.a5w"

Note - once you have a value for RedirectURL, you need to redirect the user, for example:

if return.error = .f.
   response.redirect("index.a5w") ' login success page
else
   response.redirect("message.a5w") ' login failed message page
end if

Limitations

Web applications only.

See Also