netlify-labs / react-netlify-identity

a tiny (4kb) React hook for using Netlify Identity, no UI. SEEKING MAINTAINERS
https://netlify-gotrue-in-react.netlify.com/
156 stars 25 forks source link

recoverAccount workflow #28

Closed ljosberinn closed 4 years ago

ljosberinn commented 4 years ago

Hi, so I've been tinkering with a reset-password route for a while and found this issue:

It's finally working but imo that's a mess. Am I doing something massively wrong here?

swyxio commented 4 years ago

i dont think so. im not sure why i commented out that line in runRoutes. i think there was a PR complaining about this a while back but i dont think i accepted it. (edit: ah - i think this is because it’s better implemented in react-netlify-identity-widget? thats what i use anyway)

in any case - please feel free to PR what you think should be done - you have clearly done all the necessary research to fully understand this problem. I’m not currently active on this project right now but could very well come back to it at any time

ljosberinn commented 4 years ago

Brainstorming here a little, let me know if this is over the top.

if(token) { switch(type) { case 'recovery': replace('/settings/change-password'); break; // etc }

return null; }


Also, `recoverAccount(token)` and all other functions using `token` would need to consume said token and remove it afterwards.
swyxio commented 4 years ago

this is an interesting approach! i was tempted to suggest returning an array of tokens, but realistically i dont think that is ever going to happen. so i think this works. if you'd like to try a PR, be my guest, if not i'll take a crack whenever i get back to this