Actions
Issue #3075
closedNot able to create a new user using API
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 28
Quarter:
Description
I am using httpie to send a request to Pulp3 endpoint to create a new user. netrc file has the following configuration.
machine f26-p3
login admin
password admin
http POST http://f26-p3:8000/api/v3/users/ username=test_alpha23 password=1234
HTTP/1.0 500 Internal Server Error
Content-Length: 19283
Content-Type: text/plain
Date: Tue, 17 Oct 2017 15:48:04 GMT
Server: WSGIServer/0.2 CPython/3.6.2
Vary: Cookie
X-Frame-Options: SAMEORIGIN
KeyError at /api/v3/users/
'reset_jwt_secret'
Request Method: POST
Request URL: http://f26-p3:8000/api/v3/users/
Django Version: 1.11.6
Python Executable: /home/pulp/pulpvenv/bin/python3
Python Version: 3.6.2
Python Path: ['/home/pulp/pulpvenv/bin', '/usr/lib64/python36.zip', '/usr/lib64/python3.6', '/usr/lib64/python3.6/lib-dynload', '/home/pulp/pulpvenv/lib64/python3.6/site-packages', '/home/pulp/pulpvenv/lib/python3.6/site-packages', '/home/pulp']
Server time: Tue, 17 Oct 2017 15:48:04 +0000
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_filters',
'rest_framework',
'pulpcore.app',
'pulp_file.app.PulpFilePluginAppConfig']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "/home/pulp/pulpvenv/lib64/python3.6/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/home/pulp/pulpvenv/lib64/python3.6/site-packages/django/core/handlers/base.py" in _legacy_get_response
249. response = self._get_response(request)
File "/home/pulp/pulpvenv/lib64/python3.6/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/home/pulp/pulpvenv/lib64/python3.6/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/pulp/pulpvenv/lib64/python3.6/site-packages/django/views/decorators/csrf.py" in wrapped_view
58. return view_func(*args, **kwargs)
File "/home/pulp/pulpvenv/lib64/python3.6/site-packages/rest_framework/viewsets.py" in view
90. return self.dispatch(request, *args, **kwargs)
File "/home/pulp/pulpvenv/lib64/python3.6/site-packages/rest_framework/views.py" in dispatch
489. response = self.handle_exception(exc)
File "/home/pulp/pulpvenv/lib64/python3.6/site-packages/rest_framework/views.py" in handle_exception
449. self.raise_uncaught_exception(exc)
File "/home/pulp/pulpvenv/lib64/python3.6/site-packages/rest_framework/views.py" in dispatch
486. response = handler(request, *args, **kwargs)
File "/home/pulp/pulpvenv/lib64/python3.6/site-packages/rest_framework/mixins.py" in create
20. serializer.is_valid(raise_exception=True)
File "/home/pulp/pulpvenv/lib64/python3.6/site-packages/rest_framework/serializers.py" in is_valid
236. self._validated_data = self.run_validation(self.initial_data)
File "/home/pulp/pulpvenv/lib64/python3.6/site-packages/rest_framework/serializers.py" in run_validation
434. value = self.validate(value)
File "/home/pulp/pulpvenv/lib64/python3.6/site-packages/pulpcore/app/serializers/user.py" in validate
74. if data["reset_jwt_secret"]:
Exception Type: KeyError at /api/v3/users/
Exception Value: 'reset_jwt_secret'
Request information:
USER: admin
Pulp3 Version:
pulp-file==0.0.1a2
pulpcore==3.0.0a4
pulpcore-common==3.0.0a4
pulpcore-plugin==0.0.1a4
OS version:
Fedora release 26 (Twenty Six)
Actions
Create a new jwt reset endpoint instead of a user field
Creating a new endpoint for resetting jwts instead of having a field on user to reset them. This also fixes user creation which is currently broken.
fixes #3075 https://pulp.plan.io/issues/3075