0

Is there a way to set private the email property of a PFUser class, without having to set private the entire class?

rici
  • 234,347
  • 28
  • 237
  • 341
Guido Lodetti
  • 739
  • 2
  • 8
  • 20

2 Answers2

0

It's been requested for a few years over and over again to add the ability to do this but the Parse team has yet to release anything.

nick9999
  • 601
  • 1
  • 8
  • 22
0

If you place the email in a PrivateUserData subclass, the email can be private, but the password reset function can no longer work. Unless you set the email of the User object to be your own email and do something about it... :)

The following could make it work:

You could make a PublicUserData subclass and place all the user information that you intend to be able to be publicly read in that class, such as the username. Then, make the User subclass private. Anytime you want to access the User subclass to modify information, just log in the user.

  var PublicUserData = Parse.Object.extend("PublicUserData");
  var publicData = new PublicUserData();
  publicData.set("username", username);
  publicData.set("userId", user.id);
  publicData.save(null, {
      success: function(projectData) {
      },
      error: function(projectData, error) {
        alert(error.message);
      }
  });
Toad22222
  • 387
  • 1
  • 3
  • 13