Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
	Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
			
		
		
			- 
				
																			 link76
- Posts: 99
- Joined: Fri Nov 04, 2011 1:52 pm
						
						
													
							
						
									
						Post
					
								by link76 » 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!
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
 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 MaxV
- Posts: 1580
- Joined: Tue May 28, 2013 2:20 pm
- 
				Contact:
				
			
						
						
													
							
						
									
						Post
					
								by MaxV » Tue Oct 31, 2017 12:21 pm
			
			
			
			
			Try this:
Code: Select all
on keyUp
   lock screen
   set the imagesource the last char of me to 922
   unlock screen
end keyUp
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
						 
		 
				
		
		 
	 
	
				
	
				
		
		
			- 
				
																			 richmond62
- Livecode Opensource Backer
  
- Posts: 10202
- Joined: Fri Feb 19, 2010 10:17 am
						
						
													
							
						
									
						Post
					
								by richmond62 » Tue Oct 31, 2017 1:51 pm
			
			
			
			
			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.
			
			
									
									
						 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 richmond62
- Livecode Opensource Backer
  
- Posts: 10202
- Joined: Fri Feb 19, 2010 10:17 am
						
						
													
							
						
									
						Post
					
								by richmond62 » Tue Oct 31, 2017 1:56 pm
			
			
			
			
			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.
			
			
									
									
						 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 link76
- Posts: 99
- Joined: Fri Nov 04, 2011 1:52 pm
						
						
													
							
						
									
						Post
					
								by link76 » Tue Oct 31, 2017 3:11 pm
			
			
			
			
			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
			
			
									
									
						 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 Klaus
- Posts: 14255
- Joined: Sat Apr 08, 2006 8:41 am
- 
				Contact:
				
			
						
						
													
							
						
									
						Post
					
								by Klaus » Tue Oct 31, 2017 3:35 pm
			
			
			
			
			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
 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 bogs
- Posts: 5480
- Joined: Sat Feb 25, 2017 10:45 pm
						
						
													
							
						
									
						Post
					
								by bogs » Tue Oct 31, 2017 3:38 pm
			
			
			
			
			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.
 
		 
				
		
		 
	 
	
				
	
				
		
		
			- 
				
																			 richmond62
- Livecode Opensource Backer
  
- Posts: 10202
- Joined: Fri Feb 19, 2010 10:17 am
						
						
													
							
						
									
						Post
					
								by richmond62 » 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.
 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 Klaus
- Posts: 14255
- Joined: Sat Apr 08, 2006 8:41 am
- 
				Contact:
				
			
						
						
													
							
						
									
						Post
					
								by Klaus » 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".
 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 jacque
- VIP Livecode Opensource Backer
  
- Posts: 7403
- Joined: Sat Apr 08, 2006 8:31 pm
- 
				Contact:
				
			
						
						
													
							
						
									
						Post
					
								by jacque » Tue Oct 31, 2017 8:10 pm
			
			
			
			
			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.
Jacqueline Landman Gay         |     jacque at hyperactivesw dot com
HyperActive Software           |     http://www.hyperactivesw.com
						 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 SparkOut
- Posts: 2952
- Joined: Sun Sep 23, 2007 4:58 pm
						
						
													
							
						
									
						Post
					
								by SparkOut » Tue Oct 31, 2017 10:27 pm
			
			
			
			
			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.
 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 Klaus
- Posts: 14255
- Joined: Sat Apr 08, 2006 8:41 am
- 
				Contact:
				
			
						
						
													
							
						
									
						Post
					
								by Klaus » Tue Oct 31, 2017 11:06 pm
			
			
			
			
			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. 

 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 MaxV
- Posts: 1580
- Joined: Tue May 28, 2013 2:20 pm
- 
				Contact:
				
			
						
						
													
							
						
									
						Post
					
								by MaxV » Thu Nov 02, 2017 10:17 am
			
			
			
			
			The 
ask password of livecode is not good enough?  

Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w