supermar10
supermar10

Reputation: 180

Parseplatform: Prevent save without giving the client information over the outcome

I want to have a BeforeSave trigger, in which I decide based on some other table if a specific object should be saved or not.

I know I just can throw, then the object will not be saved, but then the client gets an error message. I want the client not getting any definite information about the saving status.

Why I need this is, we are having an app where only user with their email addresses preregistered in our system should be able to register. In order to prevent anyone from getting knowledge of the email addresses of our preregistered users, I don't want to send any confirmation of success.

Upvotes: 0

Views: 25

Answers (1)

LulzCow
LulzCow

Reputation: 1229

If you don't want to return an error, you could create a wrapper function that always returns success in cloud code.

Parse.Cloud.define("saveUserEmail", function(req)){
    var user = req.user,
        email = req.params.email
    user.set("email", email);
    user.save(null, {useMasterKey:true});
    return;
});

And from your client: Parse.Cloud.run("saveUserEmail", {email:"email@domain"});

Upvotes: 1

Related Questions