Page 1 of 2
HOW to unseen Password when user is typing
Posted: Sun Aug 25, 2013 12:07 am
by ECNU4271
Hi,all!
When user is entering password, I'd like to make what user types as ****** so that it wouldn't be seen by others.
What should I do to achieve this?
Besides,when the keyboard on iPhone comes out, it might cover the lines that the user is currently typing therefore user can't see what he has typed.
How to solve this problem?
Thanks!
I am completely new to LiveCode and want to make some apps by myself to impress my friend.
Michael
Re: HOW to unseen Password when user is typing
Posted: Sun Aug 25, 2013 12:20 am
by Simon
Hi Michael,
For the first question look up "keyDown" in the dictionary.
It's a fun exercise, but if you need more help just ask again.
The second question is solved by:
put the effective working screenRect into tRect
tRect now contains the viewable screen area, you use that to re-position your field.
Simon
Re: HOW to unseen Password when user is typing
Posted: Sun Aug 25, 2013 12:29 am
by FourthWorld
Re: HOW to unseen Password when user is typing
Posted: Sun Aug 25, 2013 12:29 am
by ECNU4271
Simon wrote:Hi Michael,
For the first question look up "keyDown" in the dictionary.
It's a fun exercise, but if you need more help just ask again.
The second question is solved by:
put the effective working screenRect into tRect
tRect now contains the viewable screen area, you use that to re-position your field.
Simon
Thanks, Simon.
The second question, what do you mean? Should I put the sentence into script or what?
I am a noobie, sorry, I only understand the front-end work, not the coding part.
Re: HOW to unseen Password when user is typing
Posted: Sun Aug 25, 2013 12:32 am
by ECNU4271
It seems the password there is about to teach you how to give stack a password. Not how to unseen some text... But thanks anyways...
Re: HOW to unseen Password when user is typing
Posted: Sun Aug 25, 2013 12:33 am
by Simon
Richards answer solved both for you in 1 go.
Simon
Re: HOW to unseen Password when user is typing
Posted: Sun Aug 25, 2013 12:47 am
by ECNU4271
Simon wrote:Richards answer solved both for you in 1 go.
Simon
All right. I see "ask password" this time.
But what do I write in the script to make this field ****
I tried ask password of Field "Password"
It doesnt work...
Re: HOW to unseen Password when user is typing
Posted: Sun Aug 25, 2013 12:51 am
by Simon
It's "ask password"
Code: Select all
on mouseUp
ask password "Please enter the administrator password."
if it is empty then exit to top
if it = the uPassword of this stack then --uPassword contains the correct password
# right password; proceed
else
# incorrect password
answer "Incorrect password. Please try again."
end if
end mouseUp
Just put that in a button you'll see.
Simon
Re: HOW to unseen Password when user is typing
Posted: Sun Aug 25, 2013 1:00 am
by ECNU4271
Simon wrote:It's "ask password"
Code: Select all
on mouseUp
ask password "Please enter the administrator password."
if it is empty then exit to top
if it = the uPassword of this stack then --uPassword contains the correct password
# right password; proceed
else
# incorrect password
answer "Incorrect password. Please try again."
end if
end mouseUp
Just put that in a button you'll see.
Simon
Thanks Simon.
I tried. It works very well if there is only an admin needs to log in.
The field appears in the Register page. So the password field, I want it to be unseen. not the button or verification.
Same as the password field in the Login page.
How would this work?
Michael
Re: HOW to unseen Password when user is typing
Posted: Sun Aug 25, 2013 4:34 am
by Simon
Not sure I follow you.
Are you asking about the first time someone writes their password?
Re: HOW to unseen Password when user is typing
Posted: Sun Aug 25, 2013 1:15 pm
by ECNU4271
Simon wrote:Not sure I follow you.
Are you asking about the first time someone writes their password?
Yeah, when a user wants to sign up, he needs to enter the password, that's where I want the information unseen.
Michael
Re: HOW to unseen Password when user is typing
Posted: Sun Aug 25, 2013 1:29 pm
by Simon
Use the same ask password in the code but instead of "if it =" use "put it somewhere". (somewhere is not a LC function, it's just a var or field or file, you choose (Wow the trouble with an English-like language))
The "it" variable contains anything they typed.
Do you know how to to use "breakpoint" and step through the code? Breakpoint allows you to watch what is happening in the variable watcher when each line executes. I only add this because I figure you ran the code but never saw what was happening.
Simon
Re: HOW to unseen Password when user is typing
Posted: Sun Aug 25, 2013 3:02 pm
by ECNU4271
Simon wrote:Use the same ask password in the code but instead of "if it =" use "put it somewhere". (somewhere is not a LC function, it's just a var or field or file, you choose (Wow the trouble with an English-like language))
The "it" variable contains anything they typed.
Do you know how to to use "breakpoint" and step through the code? Breakpoint allows you to watch what is happening in the variable watcher when each line executes. I only add this because I figure you ran the code but never saw what was happening.
Simon
OK, I understand what you mean. But the password should be on a blank that needs to be filled in. (Like this: Password: ______)
There is no button, how can I make use of mouseUp anyway?
Michael
Re: HOW to unseen Password when user is typing
Posted: Sun Aug 25, 2013 3:25 pm
by Simon
Hey Michael,
I'm guessing English is not your first language? No problem, but this will take longer. (Do you use an online translator, would be cool to see how good they are translating to English).
You are building a registration form that has a few fields that need filling out (e.g. first name, last name, phone) and in that you want to allow the user to enter a password?
With that I see how "ask password" is not like other registration forms, but it can be used on subsequent visits.
If that is the case then again look up "keydown" in the dictionary. You intercept the keydown and replace it with "*" in your password field. Please try it first using a breakpoint and step through the code, see if you can figure it out.
The keyboard covering up the field is another problem, one thing at a time.
Simon
Re: HOW to unseen Password when user is typing
Posted: Sun Aug 25, 2013 3:39 pm
by ECNU4271
Simon wrote:Hey Michael,
I'm guessing English is not your first language? No problem, but this will take longer. (Do you use an online translator, would be cool to see how good they are translating to English).
You are building a registration form that has a few fields that need filling out (e.g. first name, last name, phone) and in that you want to allow the user to enter a password?
With that I see how "ask password" is not like other registration forms, but it can be used on subsequent visits.
If that is the case then again look up "keydown" in the dictionary. You intercept the keydown and replace it with "*" in your password field. Please try it first using a breakpoint and step through the code, see if you can figure it out.
The keyboard covering up the field is another problem, one thing at a time.
Simon
Thanks for your kind understanding, Simon!
I tried
on keyDown
intercept the keydown and replace it with "*" in field "password"
end keyDown
Obviously, error at line2...