garay@hyper.lap.upenn.edu (John Garay) (04/13/91)
Thanks to Everyone who sent suggestions about the password entry.
From all of those suggestions, here's what I built for TP3.01 on an IBM.
{*****************}
Procedure GetPassWd;
Var Tempwd:string[15];
oldtemp:string[15];
Begin {GetPasswd}
clrscr;
write('Password (dots will echo): ');
passwd:='';
tempwd:='';
oldtemp:='';
Repeat
oldtemp:=tempwd;
tempwd:=passwd;
Read(kbd, ch);
if (Ord(ch)<>13) and (Ord(ch)<>8) then
Begin
Passwd:=Passwd + ch;
write('.');
End;
if (Ord(ch)=8) then {Backspace}
Begin
write(ch);
passwd:=oldtemp; {Put passwd minus one character}
End;
Until (Ord(ch)=13); {Until Enter is Pressed}
End; {GetPassWd}
{****************}
The tempwd and oldtemp Vars allow the use of the backspace to correct the
password if mistyped. It's not the cleanest code I've ever seen, BUT it get
the job done. Thanks for the Help!
******************************************************************************
John Garay e-mail : garay@hyper.lap.upenn.edu
Office phone : (215) 898-1954
Home Phone : (215) 382-4102
Donations : 4034 Walnut, Philly, PA 19104
"Change the Way People think, and things will Never be the Same." S. Biko
******************************************************************************