Code: Select all
function lGetPassword()
local oDlg, oUser, oPass
local nTries := 0 //Nº de intentos que quiero permitir
local lGo := .f.
local oImg
x_user = UPPER(GETENV("USERNAME"))+ space(4)
x_pass = space(10)
DEFINE DIALOG oDlg ;
FROM 5, 5 TO 20, 50 ;
TITLE "Por favor identifiquese..."
@ 1, 1 BITMAP oBmp FILENAME ".\..\Bmp\Pass.Bmp" OF oDlg NOBORDER
@ 1, 8 SAY "GESTION OPERATIVA" OF oDlg
@ 4, 1 SAY "Nombre:" OF oDlg
@ 5.3, 1 SAY "P. de Acceso:" OF oDlg
@ 4, 8 GET oUser VAR x_user picture "@!" OF oDlg SIZE 50 , 10 UPDATE
@ 5.3, 8 GET oPass VAR x_pass picture "@!" OF oDlg PASSWORD SIZE 50 , 10
@ 2, 14 IMAGE oImg FILE "..\COMU\FOTOS\"+alltrim(x_user)+".jpg" SIZE 50, 60 ADJUST UPDATE
@ 5, 4 BUTTON "&Continuar" OF oDlg ;
ACTION ( nTries++,;
lGo := ComprueboAcceso( x_user, x_pass ) ,;
If( nTries > 3 .or. lGo, oDlg:End(),;
( MsgAlert( "Datos Incorrectos..."+ Chr(13) +"Intenta otra vez" ), oUser:SetFocus(), oPass:SetFocus() ) ) )
oBmp:lTransparent = .t. // Hago el bmp transparente
ACTIVATE DIALOG oDlg CENTERED ON PAINT ( oPass:SetFocus() )
return lGo