dp22+@andrew.cmu.edu (David Bruce Pinkus) (03/25/89)
I'm trying to protect an application with a password request on the front end.... I'm using FoxBASE on a Mac, and on the Mac II version I set the foreground colour equal to the background colour. On the Non-colour version though, I can't get it to not display what characters the user is typing. If you have a small routine to do this, or any suggestions, they would be very appreciated. Thank you. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Dave Pinkus | ARPAnet: dp22+@andrew.cmu.edu | I is a | Carnegie Mellon U. | BITNET: q109dp22@CMCCVB | college | Pittsburgh, PA | UUCP: ...!harvard!andrew.cmu.edu!dp22 | student | - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - =
alexis@ccnysci.UUCP (Alexis Rosen) (03/30/89)
In article <IY-cdIy00WB90D-KUq@andrew.cmu.edu> dp22+@andrew.cmu.edu (David Bruce Pinkus) writes: >I'm trying to protect an application with a password request on the front >end.... I'm using FoxBASE on a Mac, and on the Mac II version I set the >foreground colour equal to the background colour. On the Non-colour version >though, I can't get it to not display what characters the user is typing. >If you have a small routine to do this, or any suggestions, they would >be very appreciated. Thank you. I have tried this also. It doesn't work. While there are some (not-yet- documented) transfer modes that you can use, there are two alternatives which I think are better. The first id to create a password font. Just take Monaco and change all of the printing characters to blanks. Then change the name of the font to something like ".passwd" (the dot prevents it from showing up in font menus. You leave the font in your resource file (you know, the one you "Set Resource To") or into your bound procedure file (when you've got a final version) if you want. Then just use this font for GETs. If you don't want to mess with fonts, there's a really funky trick that actually works very well. Just use a very small font size in the GET. Try 2 or 3 points. Users seem to like this because it gives them some visual feedback while they type. I have appended some code which does this. It's very old, and hasn't been touched much in a long time (except to add the Sys(1034) line) so the style is less than perfect. I'd write it quite differently today. But... It works. Beware of things like setting confirm, which is not a bug but a matter of personal preference. --- Alexis Rosen alexis@ccnysci.{uucp,bitnet} ---------- * GetEmpCode(msg) * Gets employee code and pw. If they match, returns code, otherwise "". * Assumes Employees file, indexed by code, is aliased to "Emps" * MUST always leave record pointer for Emps where the code was found. * Uses Public vars abortsnd, errsnd * Uses output screen 9, restores former screen when done *** Uses macro to re-select the file which was current when this routine was entered *** Since macros are a Bad Thing, replace that statement when you can just say "Select strexp" Param msg && msg is the message displayed at the top of the dialog Priv s && current screen on entry Priv cd,p && code and password Priv curfile && alias of the current file s=Val(Sys(1034)) curfile=Str(Select()) Select Emps && use employees file Screen 9 At 80,65 Type 1 Size 7,33 Font "Geneva",18 TOP Clear @ Pixels 40,0 To 41,350 @ 0,1 Say msg Font ,18+256 @ 2,1 Say "Please identify yourself--" @ 4,1 Say "Code:" @ 6,1 Say "Password:" Do While .T. cd=" " @ 4,7 Get cd Size 1,6 && leave extra space Set Confirm On Read Set Confirm Off If Mod(Readkey(),256)=0 && backed out of field Loop && try again Endif If Mod(Readkey(),256)#15 .OR. Trim(cd)=="" && abort ??abortsnd Screen s Lock TOP && bring back calling prog's screen Screen 9 Delete Select &curfile Return "" Endif Seek Upper(Left(cd,4)) If Found() cd=code && case might differ Exit Else ??errsnd EndIf Enddo @ 0, 1 Say "Hello, "+Left(name,At(" ",name)-1)+"." Size 1,32 Do While .T. p=" " @ 6,11 Get p Font,3 Size 1,9 Set Confirm On Read Set Confirm Off If Mod(Readkey(),256)=0 && backed out of field Loop && try again Endif If Mod(Readkey(),256)#15 .OR. Trim(p)=="" && abort ??abortsnd Screen s Lock TOP && bring back calling prog's screen Screen 9 Delete Select &curfile Return "" Endif If Upper(Trim(p))==Upper(Trim(pw)) && password's OK Exit && the do input loop Else ??abortsnd && with the extra beep from the alert, makes errsnd Alert Stop 2 "That is not the correct password." Endif Enddo Select &curfile Screen s Lock TOP && bring back calling prog's screen Screen 9 Delete Return cd && to get here, cd must be right and pw is OK p.s. the variables abortsnd and errsnd are two and three chr(7)s, respectively.