Users cannot login after password reset

Hi,

(I see this happened to many people before, but I couldn’t find a solution searching here)

I’m adding user accounts to my app and I’m trying to reset the password of a user. The issue I have is that after receiving the link and changing the password, the user cannot login again (neither using the old password or the new).

Steps to reproduce:

  • Create a user
  • Request a password reset (use JS API or REST, doesn’t work anyway)
  • Go to your mail and click the link
  • Change the password (after that, the user gets updated in the DB)
  • Now try to login with the new password
  • An “Invalid login or password” is received.

Thanks in advance.

Hi @ERIC_ROS,

Welcome to the community! I was not able to reproduce it in my app. Please provide us with the appId where you have the issue. Can we create a test account there in order to reproduce the issue?

Regards,
Marina

Sure, here’s the appId E99FDC4B-7371-3E56-FF89-79E21F0E0100
Yes, create the users you need.

@ERIC_ROS, it works as well in your app. Please see below:


So now I have to ask you, how do you reset a password? As I see, your app has the “User requests password reset” template enabled. So the new password is sent directly to the email. There is no link in this flow. In order to reset password via link, you need to enable the “User requests password reset by link” template in Messages → Email.

Regards,
Marina

I tried both settings (sending random password or a link). This is why you found it changed. Anyway, I tried it again but using the REST API for login, and it works. I was using the JS API until now, with no issues, but maybe there’s something wrong in my implementation or it’s a potential bug in that API.

Thanks

@ERIC_ROS, Have you tried user login using the JS API and it did not work? I will check it as well

Yes, this is my code:

    Backendless.UserService.login( email, password, stayLoggedIn || true )
    .then( function( loggedInUser: any ) {
      // do something
      })

@ERIC_ROS This one works as well:

function success( result )
{
  console.log( JSON.stringify(result) );
}

function error( err )
{
  console.log( err.message );
  console.log( err.statusCode );
}

 Backendless.UserService.login( "Backendless@gmail.com", "1",  true )
 .then( success )
 .catch( error );

Regards,
Marina

Ok, I found the problem. There was a bug in my code. I messed up the password I was sending to the server…
Thanks for your time :slight_smile: