Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When GLOBAL_LOGIN_REQUIRED = True 500 error is shown #1081

Open
davidchua opened this issue Oct 9, 2024 · 1 comment · May be fixed by #1082
Open

When GLOBAL_LOGIN_REQUIRED = True 500 error is shown #1081

davidchua opened this issue Oct 9, 2024 · 1 comment · May be fixed by #1082
Assignees

Comments

@davidchua
Copy link

davidchua commented Oct 9, 2024

Describe the issue
When installing mediacms (Single Server), setting "GLOBAL_LOGIN_REQUIRED = True" returns an error

AttributeError: 'WSGIRequest' object has no attribute 'user'
Internal Server Error: /favicon.ico
Traceback (most recent call last):
  File "/home/mediacms.io/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/home/mediacms.io/lib/python3.10/site-packages/django/utils/deprecation.py", line 133, in __call__
    response = self.process_request(request)
  File "/home/mediacms.io/lib/python3.10/site-packages/login_required/middleware.py", line 55, in process_request
    return self._login_required(request)
  File "/home/mediacms.io/lib/python3.10/site-packages/login_required/middleware.py", line 22, in _login_required
    if request.user.is_authenticated:
AttributeError: 'WSGIRequest' object has no attribute 'user'

To Reproduce
Steps to reproduce the issue:

  1. Follow the instructions in https://github.com/mediacms-io/mediacms/blob/main/docs/admins_docs.md#2-server-installation
  2. Access the web interface and see that the instance UI loads without issue. Ensure you're not signed in.
  3. in mediacms/cms/local_settings.py set GLOBAL_LOGIN_REQUIRED = True
  4. Restart services sudo systemctl restart mediacms celery_short celery_long
  5. Access the webpage again and you should see a 500 error with the logs returned above.

Expected behavior

Webpage should load with a Login Screen when you're not logged in.

Environment (please complete the following information):

  • OS: Ubuntu Jammy Server
  • Installation method: Single Server
  • Browser, if applicable

Additional context

Commit hash of directory is

commit 6bbd4c28094cbd64af2ed2dc120884510fc75093 (HEAD -> main, origin/main, origin/HEAD)
@davidchua
Copy link
Author

I've found the issue and opened PR #1082 that should fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants