views:

419

answers:

1

I was designing a form which asks the user to type in a password and then to verify again in the next field. I noticed however, that if I copy and paste from the first password field to the other, the values are not same.

It seems my Firefox running on Mac OS X, copies the asterisk graphic instead, which has the value '\x95'

Is it possible to copy the underlying text from the password field?

Thanks

+5  A: 

No. Copy/Paste is disabled for security reasons. If you want to allow people to copy/paste the password, why require verification in the first place?

Edit:

If you really want to copy the password to the user's clipboard, it's possible using JavaScript and Flash, but I strongly recommend against it since it's a big security problem.

You can use javascript to get the password:

var input = document.getElementById('myInputId');
var password = input.value;

And this library will let you copy data to the clipboard.

Then again, if you consider this acceptable then the password must not really be a secret. In that case, why not use a normal text field?

interjay
I dont want people to copy paste it in but still wanted to know if it was possible.If i need to copy the password entered to the users clipboard, how do I go about managing that?
Ali
Thanks, that helps a lot.
Ali