Thomas Anderson7286790
Posts: 0
Joined: Sat Dec 20, 2014 3:46 pm

Using email as username - problems with Password Recovery tutorial

I have created an app that writes the user's email into the username field in my user's database. No issues there... However, when I built password recovery features into my app based on this tutorial:

http://devcenter.appery.io/tutorials/...

I cannot get my service request to find the user when sending an email address as the value for 'username'.

I get the following response:

{
"message":"User not found"
}

When I create a username in the database that is a non-email string (i.e. "johndoe"), and re-test the service, the user is identified and the recovery code is sent out by email via SendGrid as intended.

Any ideas?

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Using email as username - problems with Password Recovery tutorial

Hello,

Please show a screenshot of the mapping and service settings.

Thomas Anderson7286790
Posts: 0
Joined: Sat Dec 20, 2014 3:46 pm

Using email as username - problems with Password Recovery tutorial

Haven't set up the mapping yet. I'm using the test feature in the service settings.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Using email as username - problems with Password Recovery tutorial

Hi Thomas,

Please use following line of JS code in where clause:

pre

"where": '{"username": "' + encodeURIComponent(username) + '"}'

/pre

So the username should be urlEncoded.

Regards.

Thomas Anderson7286790
Posts: 0
Joined: Sat Dec 20, 2014 3:46 pm

Using email as username - problems with Password Recovery tutorial

Did you mean

"where": '{"username": "' + encodeURI(username) + '"}'

instead of

"where": '{"username": "' + encodeURIComponent(username) + '"}' ?

encodeURI appears to work!

Regards,

Thomas

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Using email as username - problems with Password Recovery tutorial

Hi Thomas,

Yes... Glad it works.

Regards.

Vinny B
Posts: 0
Joined: Fri Aug 22, 2014 2:22 pm

Using email as username - problems with Password Recovery tutorial

Hello

Code: Select all

I have the same problem but I do not know where to put the above code. I do not have a where field. I am mapping to a username field like the tutorial says. If i past your code into the js in mapping I get a error with the code.  

I need to use a email as a username.

Thank You
Vinny

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

Using email as username - problems with Password Recovery tutorial

Add a request parameter for the service by the name of "where"

Image

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Using email as username - problems with Password Recovery tutorial

Hello!

1) Please add a database service called query
2) Open it and you will see where parameter
or
1) open a database collection
2) click on FIND button
3) create service with all the settings for this request type
4) add where parameter manually (click add in the request tab of a service)

Vinny B
Posts: 0
Joined: Fri Aug 22, 2014 2:22 pm

Using email as username - problems with Password Recovery tutorial

The database service works fine with a username that is not an e-mail.

example vinny

The database service does not work if I use and e-mail

example a href="mailto:vinny20@gmail.com" rel="nofollow"vinny20@gmail.com/a

The server side script works fine if I use an e-mail directly in the code

I tried the where parameter and yuri code but It does not work.

Here is my where ( iam mapping from username to where)
Image

here is my console

Image

Any ideas?

Return to “Issues”