TAstaClientSocket.OnLoginAttempt


 

Applies to
TAstaClientSocket

 

Declaration
type TAstaLoginEvent = procedure(Sender: TObject;
  ClientVerified: Boolean)
of object;

property OnLoginAttempt: TAstaLoginEvent;
 

Description
The OnLoginAttempt is used to control the login process at the client side of the connection. The event allows you control how many times the user is allowed to enter a user name and password combination. This is a good place to perform initialization as well.

The login process is controlled by a number of server and client side properties and events. The TAstaServerSocket has an OnClientLogin event that controls whether or not the client has been accepted by the server.

 

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

    Application.Terminate;

  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;



ASTA Overview TAstaClientSocket.OnError TAstaClientSocket.OnLookup