Ways to manage registration in production

I need to manage registration to the admin panel in production, so that not everybody can go ahead and register. I'm wondering if there's some kind of standard way to handle this? I was thinking something like a secret key -kinda like Laravel's maintenance mode bypass. Any ideas?
4 Replies
Patrick Boivin
Patrick Boivinβ€’15mo ago
Can you describe your ideal solution?
Kanalaetxebarria
KanalaetxebarriaOPβ€’15mo ago
I've already implemented a solution that works, not sure if it's the best though. I've setup a middleware on the AdminPanelProvider's ->middleware method which basically checks for whether the route is /admin/register & if so, expects param (ex: /admin/register?key=secret). If that param is not matching an env variable, it will abort with a 404. If it does match, it will allow for routing. The overall idea is to hide registration and still provide the client a way to register new users without having to contact me every time! The solution doesn't feel like the best somehow so I wondered if there was some kind of standard way to do this (can't be the only one needing to do this) πŸ™‚
Patrick Boivin
Patrick Boivinβ€’15mo ago
I mean, it's not a bad idea. But I guess ideally you could give your client the ability to create new users from the admin? Through a UserResource or something equivalent.
Kanalaetxebarria
KanalaetxebarriaOPβ€’15mo ago
You're a god send haha. Great idea! And I will probably add a role so that only one super user can manage this resource. See that's what happens when you code alone all the time: you miss some obvious things πŸ˜‚
Want results from more Discord servers?
Add your server