Search code examples
iosparse-platformpfuser

Get length of current user's password from Parse?


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.


Solution

  • 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.