accounts-react icon indicating copy to clipboard operation
accounts-react copied to clipboard

AccountsReactComponent does not route to /reset-password as token is in path

Open lc3t35 opened this issue 7 years ago • 2 comments

In the given example

return (
      <AccountsReactComponent
        history={history}
        route={path}
        token={params.token} // for the reset-password route
      />
    )

when path is '/reset-password/:token', it does not route accordindly as it is not one of the valid state this allows to get rid of /:token

route={path.indexOf('/reset-password') !== -1 ? '/reset-password' : path}

Maybe you can change AccountsReactComponent (not easy on first look) or just update the example ?

Also I noticed that it is not mentionned to add this code on server side

import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';

Accounts.urls.resetPassword = function (token) {
  return Meteor.absoluteUrl('reset-password/' + token);
};

lc3t35 avatar Aug 01 '18 21:08 lc3t35

If i'm not wrong, "path" should return the raw url specified in the Route component but i'll check into that once I can.

And thanks, i'll update the the documentation with Accounts.urls.resetPassword!

rGiladi avatar Aug 09 '18 16:08 rGiladi

Yes this is indeed an issue.

pixlol avatar Sep 03 '18 13:09 pixlol