Page 1 of 2
					
				Hide chars field password
				Posted: Tue Oct 31, 2017 11:31 am
				by link76
				I use this code to hide a field containing a password, but when I insert the @ or # characters are not hidden!
Code: Select all
on keyDown pKey
   if the length of me <= 10 then
      put "*" after me
      put pKey after fld "hidden_psw1"
   else
      // If there are 5 or more characters in the field
      // beep and prevent text entry
      //beep
   end if
end keyDown
 
			
					
				Re: Hide chars field password
				Posted: Tue Oct 31, 2017 12:21 pm
				by MaxV
				Try this:
Code: Select all
on keyUp
   lock screen
   set the imagesource the last char of me to 922
   unlock screen
end keyUp
 
			
					
				Re: Hide chars field password
				Posted: Tue Oct 31, 2017 1:43 pm
				by richmond62
				
			 
			
					
				Re: Hide chars field password
				Posted: Tue Oct 31, 2017 1:51 pm
				by richmond62
				If you "feel funny" about using numToCodePoint(9679)  (black blob)
you can use numToCodePoint(8226) (standard Unicode Password obfuscation black blob)
you get this 'blob' if you type ALT/OPT 8 on a Macintosh.
			 
			
					
				Re: Hide chars field password
				Posted: Tue Oct 31, 2017 1:56 pm
				by richmond62
				My example stack has two fields: the one an end-user might see on-screen showing blobs, and
an off-screen field that might end up containing the actual password for the stack to use.
The only real reason for the on-screen field is so that:
1. The end-user knows s/he has entered a sufficient number of characters.
2. The end-user gets a "warm fuzzy".
as from a programming point of view it is not necessary at all.
			 
			
					
				Re: Hide chars field password
				Posted: Tue Oct 31, 2017 3:11 pm
				by link76
				how can I limit the length of the field?
on keyDown pKey
   if the length of me >= 5 then
      // If there are 5 or more characters in the field
      // beep and prevent text entry
      beep
   else
      pass keyDown
      lock screen
      put the last char of me after fld "hidden_psw1"
      set the text of the last char of me to numToCodePoint(9679)
      unlock screen		
   end if
end keyDown
			 
			
					
				Re: Hide chars field password
				Posted: Tue Oct 31, 2017 3:35 pm
				by Klaus
				Hi friends,
the easiest was is to load one of the free TTF "Password" fonts from the net and use this for your password field. Add this to your standalone and "start using font file "path_to_password.ttf". 
 
 
Best
Klaus
 
			
					
				Re: Hide chars field password
				Posted: Tue Oct 31, 2017 3:38 pm
				by bogs
				link76 wrote: ↑Tue Oct 31, 2017 3:11 pm
how can I limit the length of the field?
 
You might try 
Code: Select all
get the number of chars of field "Entry" // your field...
and then something like
From the dictionary entry for 'characters'.
Interesting idea Klaus, I know nothing about that one.
 
			
					
				Re: Hide chars field password
				Posted: Tue Oct 31, 2017 6:07 pm
				by Klaus
				Trevor De Vore (the guy who created the datagrid!), supplies the TTF font and a nice lesson here:
http://revolution.screenstepslive.com/s ... word-field 
			
					
				Re: Hide chars field password
				Posted: Tue Oct 31, 2017 7:15 pm
				by richmond62
				Surely a Password font simply consists of a font with a blob in every position:  if so anyone with half a brain
 only has to copy-paste the string somewhere else and change the font to see the password.
 
			
					
				Re: Hide chars field password
				Posted: Tue Oct 31, 2017 7:55 pm
				by Klaus
				richmond62 wrote: ↑Tue Oct 31, 2017 7:15 pm
Surely a Password font simply consists of a font with a blob in every position:  if so anyone with half a brain
 only has to copy-paste the string somewhere else and change the font to see the password.
 
Yes, and again, you, as a developer, have to prevent this, maybe by cathing the "pastekey".
 
			
					
				Re: Hide chars field password
				Posted: Tue Oct 31, 2017 8:10 pm
				by jacque
				link76 wrote: ↑Tue Oct 31, 2017 11:31 am
I use this code to hide a field containing a password, but when I insert the @ or # characters are not hidden!
 
I just tested this on Mac OS X and it works fine with # and @. Those characters are hidden the same as any others.
 
			
					
				Re: Hide chars field password
				Posted: Tue Oct 31, 2017 10:27 pm
				by SparkOut
				Klaus wrote: ↑Tue Oct 31, 2017 7:55 pm
richmond62 wrote: ↑Tue Oct 31, 2017 7:15 pm
Surely a Password font simply consists of a font with a blob in every position:  if so anyone with half a brain
 only has to copy-paste the string somewhere else and change the font to see the password.
 
Yes, and again, you, as a developer, have to prevent this, maybe by cathing the "pastekey".
 
Trevor's lesson linked above does include info related to preventing copy of the password field text. It is correct to think there is more to it than just changing the letters to identical blobs.
 
			
					
				Re: Hide chars field password
				Posted: Tue Oct 31, 2017 11:06 pm
				by Klaus
				SparkOut wrote: ↑Tue Oct 31, 2017 10:27 pm
Klaus wrote: ↑Tue Oct 31, 2017 7:55 pm
...
Yes, and again, you, as a developer, have to prevent this, maybe by cathing the "pastekey".
 
Trevor's lesson linked above does include info related to preventing copy of the password field text. It is correct to think there is more to it than just changing the letters to identical blobs.
 
Yep, maybe I should have been writing: ...have to prevent this, maybe by reading Trevors above mentioned lesson. 

 
			
					
				Re: Hide chars field password
				Posted: Thu Nov 02, 2017 10:17 am
				by MaxV
				The 
ask password of livecode is not good enough?  
