kitware-resonant / django-composed-configuration

Turnkey Django settings for data management applications.
Apache License 2.0
9 stars 2 forks source link

Consider making LOGIN_REDIRECT_URL an env Value rather than hard-coded #173

Open zachmullen opened 2 years ago

brianhelba commented 2 years ago

What's the general use case for this?

I think many downstream projects will need to override this setting, to match their particular set of routes, but I don't see why most would need to set it differently per-deployment.

zachmullen commented 2 years ago

We commonly deploy SPAs backed by Girder 4 at different domains than the server. In those cases, a fully qualified login redirect URL is desired, and it will be deployment-specific.

brianhelba commented 2 years ago

I still don't understand how this is necessary. If an SPA logs in, they will do so as part of an OAuth2 flow, which will ultimately redirect them back to the "redirect URI" of the registered OAuth2 application, at the conclusion of their login process.

Is this a problem for cases where a user is provided a link directly to the Django app, outside of an OAuth2 flow? I can think of a few places where this happens:

I don't think that just changing LOGIN_REDIRECT_URL will get the end user back to the desired SPA page at the conclusion of all user account management actions.

I wonder whether a better practice is to encourage Django projects to mount a RedirectView at /, and then define their own setting to define the redirect target. I still don't think this will capture all of the aforementioned scenarios, particularly password reset. However, Allauth settings are tricky to understand (mostly because there's so many of them), so it might actually be more maintainable if downstreams generally ignore Allauth settings and are responsible for a custom locally-defined SPA URL setting instead.

zachmullen commented 2 years ago

Sorry, it's been a while on this so I may have forgotten some context, but I think the main issue here is during new user registration, especially when email verification is optional or disabled. In those cases, the user completes registration, and they get taken to a page that actually gives a 500 error because the corresponding template doesn't exist out of the box.