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

Fix configuration without authentication #467

Merged
merged 1 commit into from Aug 18, 2023
Merged

Conversation

lkiesow
Copy link
Member

@lkiesow lkiesow commented Aug 18, 2023

If an empty password was configured in the user interface configuration, instead of requiring no authentication, pyCA would throw an internal server error:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/flask/app.py", line 2528, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lars/dev/opencast/pyCA/pyca/ui/utils.py", line 16, in decorated
    or auth.username != config('ui', 'username') \
       ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'username'

This patch fixes the issue.

@lkiesow lkiesow added the bug label Aug 18, 2023
If an empty password was configured in the user interface configuration,
instead of requiring no authentication, pyCA would throw an internal
server error:

```
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/flask/app.py", line 2528, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lars/dev/opencast/pyCA/pyca/ui/utils.py", line 16, in decorated
    or auth.username != config('ui', 'username') \
       ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'username'
```

This patch fixes the issue.
@coveralls
Copy link

Coverage Status

coverage: 91.524% (+0.03%) from 91.491% when pulling d29e1be on lkiesow:no-pass into 1f36b1e on opencast:main.

@lkiesow lkiesow merged commit 613d4f0 into opencast:main Aug 18, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants