Skip to content

Conversation

@phycodurus
Copy link
Member

In settings.py, when the AUTH_STRATEGY is LOCKED, you must add /accounts/register to OPEN_URLS or you'll be redirected to /accounts/login and that doesn't make sense if you're trying to register.

@phycodurus phycodurus requested a review from jchate6 July 24, 2025 22:51
That trailing slash matters: `/accounts/register/` !!
@jchate6
Copy link
Contributor

jchate6 commented Jul 28, 2025

I believe this is also handled by the middleware described in the README. Did you not include that in your implementation?

@phycodurus
Copy link
Member Author

phycodurus commented Jul 29, 2025

I believe this is also handled by the middleware described in the README. Did you not include that in your implementation?

Why do you think that?

I'm >90% sure the middleware was in place when we ran into the problem that this README update addresses. (and the middleware is certainly in place now).

To be clear what the behavior was:

  1. Install tom_registration according to the README
  2. Configure the REGISTRATION_STRATEGY to be 'approval_required'
  3. If your AUTH_STRATEGY is LOCKED then, when an an un-registered user clicks on the Register button in the nav-bar, they are redirected to the /accounts/login and asked to log in.

This is (I claim) because the LOCKED AUTH_STRATEGY doesn't allow the IsAuthenticated=False User access to the /accounts/register/ page. (Further, I don't think there's any middleware that could work around this mechanism).

The work around is described in the README and is to add /accounts/register/ to the list of open urls in the settings.py OPEN_URLS list. (The OPEN_URLS list are effectively exceptions to the LOCKED AUTH_STRATEGY).

@jchate6
Copy link
Contributor

jchate6 commented Jul 29, 2025

Sorry for misunderstanding the problem. I'll take a closer look tomorrow.

@jchate6 jchate6 moved this to Needs Review in TOM Toolkit Jul 30, 2025
Copy link
Contributor

@jchate6 jchate6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Thanks for this.

@phycodurus phycodurus merged commit 914c3e4 into dev Aug 1, 2025
18 checks passed
@github-project-automation github-project-automation bot moved this from Needs Review to Merged (to dev) in TOM Toolkit Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants