Page 1 of 2

Forgot Password Tutorial Assistance

Posted: Sun Feb 02, 2014 7:20 pm
by Christopher Herold

Greetings,

I am working through the Forgot Password Tutorial at
http://docs.appery.io/tutorials/build...

I am stuck at the SendEMail_service step. I call it RecoveryEmail_service in my project.

I have created the server code per the tutorial and also the RecoveryEmail_service (my name for SendEmail_service), but when I do testing on the RecoveryEmail_service by entering a known user into the username field it is not finding my username in the user database. It is giving me the error - "User not found". Any ideas why this might be happening?

I don't know how to test it to see where it might be failing. The name of the project is Contact Manager. It is shared with Appery.

Thanks for any guidance!


Forgot Password Tutorial Assistance

Posted: Sun Feb 02, 2014 8:45 pm
by Christopher Herold

I have confirmed that the database connectivity is functional (separate REST test) and that the username variable is passing through the server code during testing the service. However, for some reason the database call to check for the user is failing.

I could use help understanding how the XHRResponse (see below) is supposed to work to trouble shoot this.

Note: dbId and masterKey are entered prior to this snippet of code.

code
// Get the user with a given username from the database
var XHRResponse = XHR.send("GET", "https://api.appery.io/rest/1/db/users/", {
"headers": {
"X-Appery-Database-Id": dbId,
"X-Appery-Master-Key": masterKey
},
"parameters": {
"where": encodeURIComponent('{"username": "' + username + '"}')
}
});
/code


Forgot Password Tutorial Assistance

Posted: Sun Feb 02, 2014 10:06 pm
by Illya Stepanov

Hi Christopher -

As I can see in your service:
Image


Forgot Password Tutorial Assistance

Posted: Sun Feb 02, 2014 10:13 pm
by Christopher Herold

Can you please check that again because I am looking at it right now and it is there. I am also getting a response from the test of ""message":"User not found.12" which indicates it is calling the script.

thanks!


Forgot Password Tutorial Assistance

Posted: Mon Feb 03, 2014 12:13 am
by Christopher Herold

I have been testing an abbreviated version of this script from the server side. I have set up a test server script called TestEmail. What I have found is that if "parameters" section of the XHR.send(...) block, which includes the 'where', is removed, it will run successfully, but while the parameters block is there it fails.

Any idea why this is happening?


Forgot Password Tutorial Assistance

Posted: Mon Feb 03, 2014 12:38 am
by Christopher Herold

Perhaps I need to be more clear.

Even though the user is in the User database, the server side script provided in the tutorial

http://docs.appery.io/tutorials/build...

is not able to pull the specific user data out during testing of the server side script.

It does, however, work when I do not call the server side script, but set up a regular REST service (Test_service, in my account) that uses the databaseID and masterKey and then performs a successful where query on the database to pull out a specific user record.

Why doesn't this query work from the server side? What am I doing wrong?


Forgot Password Tutorial Assistance

Posted: Mon Feb 03, 2014 12:43 am
by Alena Prykhodko

Hello Christopher,

Please share your script with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a and tell us its name.


Forgot Password Tutorial Assistance

Posted: Mon Feb 03, 2014 12:49 am
by Christopher Herold

Hi Alena,

My project is shared.

The relevant scripts are:

(1) Services Test_service ( a REST service test of the user db query).

  • This script demonstrates that I am using the correct DB ID and master key and that calling usercode '12' works successfully.

    (2) ServerCode RecoveryEmail.

  • this script is from the tutorial http://docs.appery.io/tutorials/build... and is unable to find the user in the database via the where clause in parameters on line 25. It should be an identical query to (1).

    Let me know if I can provide more information.

    Thank you!


Forgot Password Tutorial Assistance

Posted: Mon Feb 03, 2014 3:17 pm
by Christopher Herold

Any thoughts on this or am I on my own?


Forgot Password Tutorial Assistance

Posted: Mon Feb 03, 2014 3:28 pm
by Maryna Brodina

Hello! Sorry for delay, we're working on it.