Estimados foristas.
Tengo el siguiente codigo para validar la entrada al sistema.
No encuentro como hacer para que me pida la password 3 veces ( x ej ) , y luego si aborte.
Código Delphi
[-]
procedure TLoginForm.LogInButtonClick(Sender: TObject);
begin
If edUsuario.Text = '' then
begin
edUsuario.SetFocus;
Exit;
end;
repeat
Qry_Usuarios.Sql.Clear;
Qry_Usuarios.SQL.Add('Select * from Usuarios Where Nombre = ' + QuotedStr( edUsuario.Text ) ) ;
Qry_Usuarios.Open;
if not Qry_Usuarios.Eof then
begin
if Trim(Qry_Usuarios['CLAVE']) = Trim(passwordEdit.Text) then
begin
cUsuario := edUsuario.Text;
mNivel := Qry_Usuarios['NIVEL'];
modalresult := mrOK;
Exit;
end
else
begin
MessageDlg('Contraseña inválida', mtWarning, [mbOk], 0);
Inc( nCantidad );
passWordEdit.SetFocus;
modalresult := mrRetry;
Exit;
end;
end
else
begin
Application.MessageBox('Usted no está autorizado a utilizar este sistema.', 'Sistema Protegido.');
ModalResult := mrAbort;
Exit;
end;
until nCantidad > 3;
DM.Conn_Usuarios.IsConnected := False;
end;
donde me estoy equivocando??
pd : no entiendo porque no queda bien formateado.