Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resend Verification Email Endpoint #3543

Merged
merged 3 commits into from
Mar 4, 2017
Merged

Resend Verification Email Endpoint #3543

merged 3 commits into from
Mar 4, 2017

Conversation

xyziemba
Copy link
Contributor

This adds an endpoint, /verificationEmailRequest, that allows a client to request a re-send of a verification email. I had implemented this for my own private use, but I noticed an issue and Stack Overflow question asking about this, so I'd like to get it upstream if possible.

@xyziemba
Copy link
Contributor Author

I think the test failure here is unrelated to this change. Can this be re-queued on Travis?

@steven-supersolid
Copy link
Contributor

You can close and reopen to kick the tests off again

@xyziemba xyziemba closed this Feb 22, 2017
@xyziemba xyziemba reopened this Feb 22, 2017
Copy link
Contributor

@acinader acinader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xyziemba I'm re-running the test and will look at the output. The better email verification is not necessary if you want to leave as is....

if (!email) {
throw new Parse.Error(Parse.Error.EMAIL_MISSING, 'you must provide an email');
}
if (typeof email !== 'string') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a natural place for this kind of utility code? I couldn't find one, and I'm not sure it makes sense to create one just to de-dup this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a good question... @flovilmart, any thoughts/wisdom for us?


return req.config.database.find('_User', { email: email }).then((results) => {
if (!results.length || results.length < 1) {
throw new Parse.Error(Parse.Error.EMAIL_NOT_FOUND, 'Invalid email.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than Invalid email something like ${email} not found??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to No user found with email ${email} so it matches the error in handleResetRequest.

@acinader
Copy link
Contributor

hm test still fails. lets see if updating branch fixes???

@facebook-github-bot
Copy link

@xyziemba updated the pull request - view changes

@facebook-github-bot
Copy link

@xyziemba updated the pull request - view changes

@acinader acinader merged commit 29fec01 into parse-community:master Mar 4, 2017
@xyziemba xyziemba deleted the email-verification branch March 7, 2017 00:10
@funkenstrahlen
Copy link
Contributor

I just stumbled on this issue as I try to implement resending email verification. There is no word about this feature in the parse docs. How can I use it?

@viviange
Copy link

I have the same question. I used to update emailVerified flag but that no longer works after I upgrade to latest Parse. Thanks for implementing this feature. But how can I use it?

@funkenstrahlen
Copy link
Contributor

I created a cloud function like this:

Parse.Cloud.define("verificationEmailRequest", function(request, response) {
  var email = request.params.email
  if (email) {
    verificationEmailRequest(email).then(function() {
      console.log("sent verification mail to " + email);
      response.success();
    }).catch(function(error) {
      console.log(error);
      response.error(error);
    });
  } else {
    response.error("email parameter required")
  }

});

function verificationEmailRequest(email) {
  var url = process.env.SERVER_URL + '/verificationEmailRequest';
  return Parse.Cloud.httpRequest({
    method: 'POST',
    url: url,
    body: {
      'email': email
    },
    headers: {
      "X-Parse-Application-Id": process.env.APP_ID,
      "X-Parse-Master-Key" : process.env.MASTER_KEY,
      "Content-Type": "application/json"
    }
  });
  
}

@viviange
Copy link

Thank you very much @funkenstrahlen! work like a charm!

@hphtoo

This comment was marked as off-topic.

@mtrezza
Copy link
Member

mtrezza commented Jun 28, 2022

@hphtoo For help with Parse Platform please use the community forum or community chat; we use GitHub to discuss actual product issues. In fact, if there is a bug and the endpoint cannot be called anymore, this should be discussed in a separate issue so we can fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants