Disable email verification for bulk user upload but programatically trigger user email verification for some signups

The title is a bit long but pretty much explains what i need. I have built a bulk user upload via CSV feature, the problem is that when these accounts are created the verification email gets sent, these emails have already been verified though, these guys simply receive an email and a temp pw saying login here to xyz, however, i do allow users to register by the normal means and i need these guys to receive the verification email, is it possible to programatically enable and disable this ?

for instance if disabled in the parse config on server init can i re-enable it as part of a cloud code endpoint that registers another user type ?

adding this for reference, seems another requested it Conditional email verification

I think if we could disable email verification on server config but also trigger it using this method when needed it might be an easy win

requestEmailVerification(email, options)

Is there some easy way to extend this from server cloud code UserController ? so that i can specifically hook into or clone this temporarily enabling verifications

    const maintenanceAuth = Auth.maintenance(this.config);
    var findUserForEmailVerification = new RestQuery(this.config, maintenanceAuth, '_User', {
      username,
    });
    return findUserForEmailVerification.execute().then(result => {
      if (result.results.length && result.results[0].emailVerified) {
        return Promise.resolve(result.results.length[0]);
      } else if (result.results.length) {
        query.objectId = result.results[0].objectId;
      }
      return rest.update(this.config, maintenanceAuth, '_User', query, updateFields);
    });

or maybe its easier to just temporarily disable it for a given action while a user does bulk upload, but still unsure how to approach that

Conditional email verification is on my todo list for this month, I’ll aim to have it completed within 2-3 wks.

1 Like

That would be awesome, is there a way i can keep track of when its released ?

I’ll comment the PR here when it’s submitted :blush:

1 Like
1 Like

How do you upload these users in bulk? This seems to be more an issue of the upload mechanism than of the user verification. See also Data import · Issue #307 · parse-community/parse-dashboard · GitHub

@Manuel We built a custom uploader that takes a CSV then proceeds to create parse accounts, however during the process it was sending the users verification emails which is not required for these users. I believe it happens when you do setUsername or setEmail like the below:

Just so I am aware, how long does it usually take to implement PRs ? if its a long time i may fork and use the above solution

        const user: Parse.User & any = new Parse.User(); 
        user.setPassword(password); 
        user.setUsername(email);
        user.setEmail(email);

Depends on the PR; in case of the import feature it seems that it’s almost done, see feat: Import data via CSV by dblythy · Pull Request #2360 · parse-community/parse-dashboard · GitHub.

@Manuel how about for this one with conditional email validation ?

In a few days I assume; it needs to go through review. It’s sensitive since we want to avoid any complications with existing email verification status and consider possible use cases, see the related issue discussion. Feel free to try out the branch and provide feedback if you can, this would help us to make sure we design it in a way that it’s useful for you.

1 Like