0

Parse states they do not return passwords in plain text. That's great, but is there a way to get the length of the password?

I would like to show the asterisk or bullet representation of their password in the user interface. If I can get the length of the password, I would simply add an "a" or other character for each character in the password to a secure text field or add the appropriate number of *s in a label. While I could just display 8 asterisks, they may count them and realize that's not a representation of their password, which isn't ideal.

Calling user.password on a PFUser returns nil.

Jordan H
  • 52,571
  • 37
  • 201
  • 351

1 Answers1

4

There is no way to do that unless you store the number of digits of the password somewhere. To be honest it would be terrible practice for parse to know that and frankly you should think about your UI. Knowing the number of characters in a password is a serious security hole. Passwords encryption should only be one way!

.password is nil because the password is not stored! It's hashed and compared. Never stored.

Mika
  • 5,807
  • 6
  • 38
  • 83
  • 2
    Agree, and I don't see how it would make UI sense even if the OP takes your suggestion to record length. Pre-filling a password text field with the right length of a wrong password would give user the impression that the correct password was there. That would be false, and lead to user surprise when the app takes whatever action with that wrong password that the context implies. – danh May 15 '15 at 00:04
  • 1
    Figured as such, thought I'd ask in case. Will talk to the designer to figure out a different UI. – Jordan H May 15 '15 at 01:56