Hey guys,
So I’m trying to make some special validations on sign up with Cloud Functions but my code doesn’t seem to work and I’m not sure why because I followed the docs.
const validateSignUp = (request) => {
  // Validate username
  if (!(/^[a-zA-Z0-9.\-_]*$/.test(request.username))) {
    throw "Invalid Username";
  } else if (request.username.length < 2) {
    throw "Invalid Username";
  } else if (request.username.length > 32) {
    throw "Invalid Username";
  }
  // Validate password
  if (request.password.length < 4) {
    throw "Invalid Password.";
  }
}
Moralis.Cloud.beforeSave(Moralis.User, () => {
  // any additional beforeSave logic here
}, validateSignUp);
        
      
    
 Will have to enquire regarding this.