thedevdojo / auth

This is the repo for the DevDojo Auth package
https://devdojo.com/auth
MIT License
258 stars 17 forks source link

Disable registration #41

Open Ale1x opened 2 weeks ago

Ale1x commented 2 weeks ago

Hello, is there a way to disable Users's registration?

By the way, great project, love it.

tnylea commented 1 week ago

Yeah, that could definitely be a feature. So, in the settings you were thinking about just including an extra toggle that says: Disable Registration, correct?

Where do you imagine the user would be redirected to when visiting /auth/register if it's disabled. Would the desirable redirect be to the /auth/login page?

Ale1x commented 1 week ago

I prefer that users be redirected to the ‘/’ route. If a site admin chooses to disable registration, it is likely that they do not want to disclose the existence of the login page either.

johntrickett86 commented 1 week ago

+1 on disable user registration

I'd be happy with /auth/register just returning a 404 when disabled

skdishansachin commented 1 week ago

I want to work on this enhancement if it hasn't been assigned to anyone else. @tnylea

skdishansachin commented 5 days ago

Hey everyone, just a quick reminder to consider this: I'm currently looking into what to do when the user lands on /auth/register. How about adding an input box to the authentication setup for specifying the redirection path instead of hardcoding it? This way, you have more flexibility.

@Ale1x suggested redirecting to / and @johntrickett86 suggested redirecting to the 404 page. I'd appreciate some input on this. Thank you!

johntrickett86 commented 5 days ago

Hey everyone, just a quick reminder to consider this: I'm currently looking into what to do when the user lands on /auth/register. How about adding an input box to the authentication setup for specifying the redirection path instead of hardcoding it? This way, you have more flexibility.

@Ale1x suggested redirecting to / and @johntrickett86 suggested redirecting to the 404 page. I'd appreciate some input on this. Thank you!

Maybe there could be a bool setting of Redirect if disabled, then if true you would need to specify the path?

skdishansachin commented 5 days ago

@johntrickett86, can you please explain it more? I didn't quite get it.

johntrickett86 commented 5 days ago

@johntrickett86, can you please explain it more? I didn't quite get it.

So let's say that in the auth settings page there is an option (Boolean) to disable the registration.

If false, then registration is allowed.

If true, there are further settings:

  1. Allow redirect (Boolean) - if false, registration route will return a 404 if true then registration route will redirect elsewhere
  2. Redirect path: allows user to specify where the redirect path if registration is disabled and the allow redirect option is true

It could be potentially cleaner to simply have a redirect path option and if null return a 404.

skdishansachin commented 5 days ago

@johntrickett86 Okay now I understand it. That's a cleaner and better way to handle this thank you.

tnylea commented 2 days ago

@skdishansachin I haven't started implementing this so feel free to start implementing 😉 I've just assigned you to this, but let me know if you need any assistance. Really appreciate it!

I've merged your password confirmation into main and will be tagging a new version today 👏

skdishansachin commented 2 days ago

@tnylea I will start working on this soon. Thank you.