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

Impossible to type in reset password field when custom connection resolver is defined (>= 11.31) #2106

Closed
avinesse opened this issue Mar 9, 2022 · 4 comments · Fixed by #2111
Labels
bug report This issue reports a suspect bug or issue with the SDK itself

Comments

@avinesse
Copy link

avinesse commented Mar 9, 2022

Describe the problem

Starting on v 11.31 :
When clicking "forgot password?" on the lock, it's impossible to type in the email field when a connectionResolver is defined in lockOptions.
Our connection resolver is defined as follows :

    connectionResolver: function (username, context, cb) {
      var isAdmin = /\+admin@anon.org$/.test(username);
      if (isAdmin) {
        // If the username is xxx+admin@anon.org, the connection used will be the `anon-userdb` connection.
        cb({type: 'database', name: 'anon-userdb'});
      } else {
        // Use the default approach to figure it out the connection
        cb(null);
      }
    },

Reverting to v11.30 works fine

What was the expected behavior?

Users should be able to type an email.

Environment

@avinesse avinesse added the bug report This issue reports a suspect bug or issue with the SDK itself label Mar 9, 2022
@stevehobbsdev
Copy link
Contributor

Thanks for the report @avinesse, let me take a look this week.

@Camsteack
Copy link

Hi !
Thanks for fixing the issue but there seems to be a new bug following this release. I can now type the email in the reset password field but the connection used for the reset password is not correct anymore. I have the same logic as described above but when using the cb(null); callback it's not selecting the default connection anymore ?
Thanks

@Camsteack
Copy link

So I managed to pinpoint the behavior:

  • If I try to reset the password directly then the wrong connection is being used.
  • If I try to first login with the user, it fails because I can't remember the password then I trigger the password change flow, it is using the correct connection.

@avinesse
Copy link
Author

avinesse commented Jul 22, 2022

Hi @Camsteack I've tried reproducing your problem with the new version but it seems to work fine on my end (I mean I see the correct connection in the payload of the POST /change_password request).
Can you share you connectionResolver to see if anything is different?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report This issue reports a suspect bug or issue with the SDK itself
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants