I am trying to create a routine that scrip the information enter in a field to be used in logging screen. The routine could be use asterisk to cover the password information or anything that provide security. Thanks in advance.
...
....
DEFINE WINDOW Pass FROM 13,19 TO 20,59 TITLE ' Password ' SHADOW COLOR SCHEME 7
ACTIVA WINDOW Pass
DO PASSWORD
RELEA WINDOW Pass
FOR cnt = 1 TO 40
RELEASE WINDOW ("letter"+alltrim(str(cnt)))
ENDFOR
CLEA
IF !wacceso
DO _Alerta
WAIT ' Acceso Denegado, Password no autorizado.......... ' WINDOW
CLOSE DATA
CLEA ALL
QUIT
ENDIF
....
....
....
....
PROCEDURE PASSWORD
*:-
SELE 1
IF !NET_USE('USUARIOS',.f.,8) .or. !file('USUARIOS.CDX')
IF !file('USUARIOS.CDX')
xmen = ' No existe el archivo: USUARIOS.CDX ... '
DO Mensaje WITH 1
Store .f. to Ok
ENDIF
ELSE
SET ORDER TO 1
*:-
Store 0 to wveces
DO WHILE .T.
*:-
@01,07 say 'Usuario : [ ]'
@03,07 say 'Password : [ á«ä€’ ]'
*:-
xuser = SPACE(10)
@01,20 GET xuser PICT "@!" VALID !EMPTY(xuser)
READ
IF LASTKEY()=27
Store .F. to wacceso
EXIT
ENDIF
IF !SEEK(xuser,1)
DO Mensaje1 WITH ' Usuario No est Registrado ... ',7
LOOP
ENDIF
xcontrol = PASE_USER
@01,20 SAY xuser PICT "@!"
xuser = alltrim(xuser)
xnivel = allt(nive_user)
*:- @01,12 SAY IIF(xnivel='1', 'SUPERVISOR', 'OPERADOR ')
wcol=19
wpas=''
FOR i=1 TO 7
@03,wcol+i say ''
t=0
DO WHILE t=0
t=INKEY()
ENDDO
*:-
t = Upper(chr(t))
t = 123+Asc(t)-20
wpas = wpas + chr(t)
*:-
@03,wcol+i say "*"
*:- wpas=wpas+chr(t+20)
ENDFOR
IF allt(wpas) = allt(pass_user)
DO _Alerta
if empty(xcontrol)
Store .t. to wacceso
DO mensaje1 WITH rtrim(alia_user)+', Bienvenido al Sistema ',7
* Replace pase_user with '*'
else
DO mensaje1 WITH 'Usuario '+Rtrim(alia_user)+', ya est activo en el Sistema ...',7
Store .f. to wacceso
endif
EXIT
ELSE
Store .F. to wacceso
IF wveces=2
DO mensaje1 WITH ' Acceso Denegado al Sistema... ',7
EXIT
ENDIF
DO mensaje1 WITH ' Clave de Acceso err¢nea... Otro intento ? ',7
wveces=wveces+1
ENDIF
ENDDO
ENDIF
CLOSE DATA
RETURN
structura de la tabla: C:\AMF\USUARIOS.DBF
N§ de registros: 7
éltima actualizaci¢n: 08/08/02
P g. de c¢digos: 850
Campo Nombre Tipo Ancho Dec Öndice Ordenaci¢n
1 USUA_USER Car cter 10 Asc MACHINE
2 ALIA_USER Car cter 15
3 NIVE_USER Car cter 1
4 PASS_USER Car cter 7
5 PASE_USER Car cter 1
** Total ** 35
I've tried to do the same thing, but it seem to be too much trouble so I made the background color the same as the forground so no one can see the password. All you see is the cursor move when you enter a character. Then I entered code to provide a message that informs the user if their password was entered wrong. The wrong password is erased and the cursor is repositioned for the correct password.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.