Author |
Message |
Andy
|
Posted: Sun Jan 25, 2004 5:25 pm Post subject: masking passwords |
|
|
i saw danshadow's forum thingny and noticed he didnt mask the passwords so i made this
code: | fcn getpass : string
var pass := ""
var charc : string (1)
loop
getch (charc)
exit when ord (charc) = 10
if ord (charc) = 8 and length (pass) not= 0 then
locate (whatrow, whatcol - 1)
put " " ..
locate (whatrow, whatcol - 1)
pass := pass (1 .. length (pass) - 1)
elsif ord (charc) not= 8 then
pass := pass + charc
put "*" ..
end if
end loop
put ""
result pass
end getpass
put getpass
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
shorthair
|
Posted: Sun Jan 25, 2004 5:40 pm Post subject: (No subject) |
|
|
I like that , its well done , im gonna use that in my app |
|
|
|
|
|
Mazer
|
Posted: Sun Jan 25, 2004 7:16 pm Post subject: (No subject) |
|
|
Why not use setscreen ("noecho") and avoid all that locate nonsense? |
|
|
|
|
|
McKenzie
|
Posted: Sun Jan 25, 2004 8:06 pm Post subject: (No subject) |
|
|
because the user needs feedback to know that the key was accepted, especially with a wonky kb. Oh in VB just set the passwordChar property to * in your edit box (I'm not kidding) |
|
|
|
|
|
shorthair
|
Posted: Sun Jan 25, 2004 9:24 pm Post subject: (No subject) |
|
|
does hte * represent anything , like in turing ? |
|
|
|
|
|
Dan
|
Posted: Sun Jan 25, 2004 10:35 pm Post subject: (No subject) |
|
|
McKenzie wrote: because the user needs feedback to know that the key was accepted, especially with a wonky kb. Oh in VB just set the passwordChar property to * in your edit box (I'm not kidding)
well the linux poleop have allways bivled that u should not even give out how long the pass is or at least that why i think they make there log in consloe that way |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
|
McKenzie
|
Posted: Sun Jan 25, 2004 10:53 pm Post subject: (No subject) |
|
|
For the passwordChar all the * means is that when the user types replace it with a *. You don't actually set it in the code. You just change it in the properties box. You can use any character but * is the most common. |
|
|
|
|
|
shorthair
|
Posted: Sun Jan 25, 2004 10:57 pm Post subject: (No subject) |
|
|
Thanks for clearing that up for me guys , you had me confused for a while |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Mazer
|
Posted: Mon Jan 26, 2004 10:30 am Post subject: (No subject) |
|
|
McKenzie wrote: because the user needs feedback to know that the key was accepted, especially with a wonky kb. Oh in VB just set the passwordChar property to * in your edit box (I'm not kidding)
I know they need feedback. I'm saying, use noecho so that whatever they type doesn't show up, and whenever they press a key (except backspace and enter), put a * at the location. That's how I did the login for my game, the only difference is that I was using Font.Draw instead of put. |
|
|
|
|
|
McKenzie
|
Posted: Mon Jan 26, 2004 10:38 am Post subject: (No subject) |
|
|
I'm stupid, you're right |
|
|
|
|
|
Andy
|
Posted: Mon Jan 26, 2004 11:12 am Post subject: (No subject) |
|
|
but there is not much difference... at least i dont think there is |
|
|
|
|
|
jonos
|
Posted: Mon Jan 26, 2004 11:20 am Post subject: (No subject) |
|
|
i tried making something like that, i couldn't though, that's cool. |
|
|
|
|
|
|