nicolaslopezj / meteor-apollo-accounts

Meteor accounts in GraphQL
MIT License
146 stars 37 forks source link

[changePassword]: Cannot change password multiple times #67

Open joncursi opened 7 years ago

joncursi commented 7 years ago

When I use changePassword the first time, it works.

If I go immediately back to the form and do a changePassword again, it says "Must be logged in". If I do a console.log(await userId()), it still shows the user's ID.

Why does this fail on the second time?

joncursi commented 7 years ago

I'm using react native. Seems like this method does not automatically log the user in?

joncursi commented 7 years ago

Yes this seems to be the case. Current workaround is:

        await changePassword({
          newPassword,
          oldPassword,
        }, apolloClient);
        await loginWithPassword({
          password: newPassword,
          username: data.me.username,
        }, apolloClient);

But this is dirty for two reasons:

1) You have to do an initial round trip to the server to get the user's username to login with 2) You have to do another round trip to the server after changing the password to re-log the user in with their username / email and new password.

acomito commented 5 years ago

Hmm... this seemed to work for me in the past but not it's not working anymore.