Link directly to "Register" page

axelb
2023-01-27

axelb:

Does the AshAuthentication.Phoenix router provide a link to open directly the “Register” part of the “/sign-in” route? All I could do is open the “sign in”, and then click on “Need an account?” link, which doesn’t change the URL in the navbar.

ZachDaniel:

Great question. We should probably make that use a different route, and patch to that route when the button is clicked 👍

jart:

At the moment it just uses a toggle. It could definitely be done although it’d take some thinking because of the way the sign in component iterates resources and strategies.

axelb:

Have you considered doing two separate components for SignIn and SignUp/Register? I am curious to hear your rationale for the “Single component and toggle” way. Here are pros I can think of for two components:

  • Two routes become natural
  • Can be customized and reimplemented separately by the Ash user
  • (Subjectively) that’s what I expected approaching the code as a newbie What are your thoughts on cons ?
  • Iterating resource and strategies must be factored out
  • Each component should be aware of the other’s route so they can link to it

wintermeyer:

I think a separate /register route is very useful. It feels cleaner than the current solution. I don’t so much care about the inner workings of that route just that I can send somebody an email with that route to tell him/her how to register a new account.

ZachDaniel:

Yeah, the difficulty isn’t that we don’t think it should have a route, it’s just that we derive each component on the page based on the strategies, so we’ll have to do some reworking to make those use respond to routes. Can we open an issue on the ash_authentication_phoenix repo?

ZachDaniel:

I think we should close this for now because we have an open issue, and this will get resolved when that issue is handled. Not much more to say about it aside from that we agree it should be done.

ZachDaniel:

PRs welcome ❤️