I'm trying to create new users with random passwords through cloudCode, but I always get an error. The error's body is the password I set.
Here's my code:
Parse.Cloud.define('account', function(request, response) {
Parse.Cloud.useMasterKey();
var randomString = Math.random().toString(36).slice(-8);
var user = new Parse.User();
user.setUsername(request.email);
user.setPassword(randomString);
user.signUp(null, {
success: function(newUser) {
response.success('Hooray');
},
error: function(error) {
response.error(error);
}
});
});
What I get as an error is: b.Error {code: 141, message: "{"password":"tnm3rf6r"}"}
Can anyone help ?
I've already tried placing useMasterKey() outside of the function, inside, right before the signUp, etc.