VALIDAR CLAVE

PROCEDURE VALCLAVE(OP: CHAR);

begin

realpassword:='';

textcolor(white);

case OP of

'1': realpassword:=claveempresas;

'2': realpassword:=claveclientes;

end;

clave:='';

writeln('Ingrese la clave: ');

writeln('');

ClrScr;

Posicion:=22;

Repeat

GotoXY(1,1);Write('Ingrese el Password: ');

GotoXY(Posicion,1);Tecla:=ReadKey;

if Tecla<>#8 Then

Begin

GotoXY(Posicion,1);Write('*');

Clave:=Clave + Tecla;

Posicion:=Posicion+1;

End

Else

Begin

if Clave<>'' Then

Begin

Posicion:=Posicion-1;

GotoXY(Posicion,1);Write(' ');

Delete(Clave,Length(Clave),1)

End;

End;

until Tecla=#13;

if clave=realpassword then

BEGIN

CLRSCR;

textcolor(10);

writeln('Credencial correcta, sera redirigido.');

delay(1000);

clrscr;

writeln('Presione cualquier tecla para continuar.');

readkey();

CASE OP OF

'1':EMPRESAS;

'2':CLIENTES;

end;

END

else

BEGIN

if (clave<>realpassword)then

intentos:=intentos-1;

BEGIN

if (intentos>0) then

BEGIN

CLRSCR;

sound(400);

Textcolor(4);

writeln('Clave incorrecta. Le quedan ',intentos ,' intentos');

delay(2000);

CLRSCR;

VALCLAVE(OP);

end

else

BEGIN

CLRSCR;

sound(400);

writeln('Ha agotado todos los intentos disponibles. Sera redirigido al menu principal');

delay(3000);

EXIT;

end;

end

end;

end;