www.astatech.com Manual Central ASTA Users Guide Managing the Login Process





Asta Technology Group
Welcome to the world of wireless enabled web services
advanced search
ASTA in 60 seconds
ASTA in action
Developer details
Free Internet tools
Demos
Business views
White papers
Tutorial center
Testimonials
Asta online help
ASTA Users Guide

Managing the Login Process

Key Client Server
Properties ApplicationName, AutoLoginDlg, Password, UserName UserCheckList
Methods AttemptClientLogin  
Events OnLoginAttempt OnClientLogin

ASTA provides facilities to help you manage the client login process. The Client's AutoLoginDlg property is the key to the login process. The AutoLoginDlg can be set to one of three selections:

ltLoginDlg
Displays a UserName and Password dialog. The user input is placed in the UserName and Password properties and transmitted for verification at the server. The Server's OnClientLogin event handler must be coded.

ltLoginNoDlg
Passes the values set in the UserName and Password properties, must be verified at the server. The Server's OnClientLogin event handler must be coded.

ltNoChallenge
UserName and Password properties are transmitted, automatically verified at server, no additional coding is required at the server.

No matter which option is selected, the AstaClientSocket's UserName, Password and ApplicationName are transmitted to the Server (if ltLoginDlg is selected, the UserName and Password properties are set to the input values entered by the user, then transmitted). If ltLoginDlg or ltLoginNoDlg have been selected, then you must code the AstaServerSocket's OnClientLogin event.

procedure TForm1.AstaServerSocket1ClientLogin(Sender: TObject; UserName,
  Password, AppName: String; var Verified: Boolean);
var
  AllowUserIn : Boolean;
begin
  //Do your stuff here -- typically lookup values in a database
  if AllowUserIn then Verified := True else Verified := False;
end;

If verified is set to True, then the client will be connected to the server. Whether verified is set to True or False, that result will be transmitted back to the client. Whether or not you code the AstaClientSocket's OnLoginAttempt event handler will dictate what happens next. If you do not code the event handler and then the client will either continue normally if the result was true, or terminate immediately if it is false. If you would like to take other action -- possibly allow the user three login attempts before terminating the application, or perhaps showing a menu only after the user has been verified, then you can code the OnLoginAttempt event.

procedure TForm1.AstaClientSocket1LoginAttempt(Sender: TObject;
  ClientVerified: Boolean);
begin
  //Track login attempts, kill app if they goof three times
  Inc(FLoginCounter);
  if (FLoginCounter >=3) and not(ClientVerified) then     begin
      Application.Terminate;
    end
  else
    if ClientVerified then
      // good login action goes here
      MainMenu1.Items[0].Visible := True
    else
      // bad login action goes here -- reprompt login dialog*
      AstaClientSocket1.AttemptClientLogin;
end;

* the AutoLoginDlg's property is set to ltLoginDlg

If you wish to track the users that have been logged into the server, assign a TCheckListBox to the AstaServerSocket's UserCheckList property.

 

Last modified: 5/5/2002 7:31:59 AM
Copyright © 2001-2002 Asta Technology Group, Inc. Terms & Conditions     Privacy Policy     Site Map