Page 1 of 1

Use Mailgun API in Password Recovery Script

Posted: Fri Oct 30, 2015 2:19 pm
by Josette

I'm trying to use the Mailgun API in the Password Recovery script in the tutorial instead of Sendgrid. However, I am unable to send the email successfully from the script. I do not get an error message and code: 0. Below is the code I'm using to send the email. I included my api key in the post url instead of the parameters.

if (XHRResponse.status == 200 && email) {
var XHRResponse = XHR.send("POST", "https://api:key-"api-key"@api.mailgun...", {
"parameters": {
"to": email,
"toname": "",
"subject": "Password Recovery",
"text": "Your recovery code is: " + secretCode + ". Copy and this code into the field provided.",
"from": "mailgun@"domain".mailgun.org"
}
});

Thank you for your help.


Use Mailgun API in Password Recovery Script

Posted: Fri Oct 30, 2015 3:12 pm
by Mark Wong

The way I do is add the mailgun_sending service to the page and when the user choose to recover the account, then onclick javascript will create a random string and store in the localStorage variable , and the mailgun service would send it to your user.

(You have to add a REST service for updating password with headers of master key, a mailgun_sending service to your page, and a service to create the recovery code into your database)


Use Mailgun API in Password Recovery Script

Posted: Fri Oct 30, 2015 3:36 pm
by Josette

Is it safe to this on the client side instead of the server?

I only need a way to add the api key info to the server script.


Use Mailgun API in Password Recovery Script

Posted: Mon Nov 02, 2015 5:12 pm
by Serhii Kulibaba

Hello,

You can use secure proxy to hide you key: https://devcenter.appery.io/documenta...


Use Mailgun API in Password Recovery Script

Posted: Thu Dec 31, 2015 6:05 am
by John de Quarius

Hi,

Here is a video series I've created where I'm using Mailgun and SMS (tropo) service. It's a very long video tut and two parts. The first part covers the Server Script and the second part is consuming the server code service using javascript.

I hope this would help others.

Here is the first part
https://youtu.be/k_OgJAXEfyw


Use Mailgun API in Password Recovery Script

Posted: Thu Mar 15, 2018 10:52 pm
by Frank7390035

Hello,

I was wondering if the Appery team could share a script or plugin for password recovery / email verification using mailgun

Thanks,
Frank


Use Mailgun API in Password Recovery Script

Posted: Fri Mar 16, 2018 4:08 pm
by Serhii Kulibaba

Hello Frank,

Sorry, but we don't have such a script. But you can write your own.
It has to send the random number to user's email and write the same number to the row of the same user in the database.

So if the user enters the recovery code you'll check it's value the same as the value in the database - let this user change the password