
-----------------------------------
Andy
Sun Jan 25, 2004 5:25 pm

masking passwords
-----------------------------------
i saw danshadow's forum thingny and noticed he didnt mask the passwords so i made this

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


-----------------------------------
shorthair
Sun Jan 25, 2004 5:40 pm


-----------------------------------
I like that , its well done , im gonna use that in my app

-----------------------------------
Mazer
Sun Jan 25, 2004 7:16 pm


-----------------------------------
Why not use setscreen ("noecho") and avoid all that locate nonsense?

-----------------------------------
McKenzie
Sun Jan 25, 2004 8:06 pm


-----------------------------------
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
Sun Jan 25, 2004 9:24 pm


-----------------------------------
does hte * represent anything , like in turing ?

-----------------------------------
Dan
Sun Jan 25, 2004 10:35 pm


-----------------------------------
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  :roll:

-----------------------------------
McKenzie
Sun Jan 25, 2004 10:53 pm


-----------------------------------
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
Sun Jan 25, 2004 10:57 pm


-----------------------------------
Thanks for clearing that up for me guys , you had me confused for a while  :D

-----------------------------------
Mazer
Mon Jan 26, 2004 10:30 am


-----------------------------------
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
Mon Jan 26, 2004 10:38 am


-----------------------------------
I'm stupid, you're right :oops:

-----------------------------------
Andy
Mon Jan 26, 2004 11:12 am


-----------------------------------
but there is not much difference... at least i dont think there is

-----------------------------------
jonos
Mon Jan 26, 2004 11:20 am


-----------------------------------
i tried making something like that, i couldn't though, that's cool.
