Cysion / Secproject1

8hp säkerhetsprojekt för EY
GNU General Public License v3.0
1 stars 0 forks source link

Kan inte hitta user objektet från databasen. #8

Open kevinen98 opened 3 years ago

kevinen98 commented 3 years ago
Internal Server Error: /userprofile/

IndexError at /userprofile/
list index out of range

Request Method: GET
Request URL: https://12steps.kengstrom.se/userprofile/
Django Version: 3.1.1
Python Executable: /home/kevin/Projekt/env/bin/python
Python Version: 3.7.3
Python Path: ['/home/kevin/Projekt/env/Secproject1', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/home/kevin/Projekt/env/lib/python3.7/site-packages']
Server time: Wed, 23 Dec 2020 22:31:17 +0100
Installed Applications:
['call.apps.CallConfig',
 'chat.apps.ChatConfig',
 'check.apps.CheckConfig',
 'home.apps.HomeConfig',
 'info.apps.InfoConfig',
 'login.apps.LoginConfig',
 'prepare.apps.PrepareConfig',
 'savemeplan.apps.SavemeplanConfig',
 'science.apps.ScienceConfig',
 'professionals.apps.ProfessionalsConfig',
 'userprofile.apps.UserprofileConfig',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles']
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.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback (most recent call last):
  File "/home/kevin/Projekt/env/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/home/kevin/Projekt/env/lib/python3.7/site-packages/django/core/handlers/base.py", line 179, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/kevin/Projekt/env/Secproject1/userprofile/views.py", line 22, in profile_view
    user = login.models.User.objects.filter(UserId=request.session['UserId'])[0]
  File "/home/kevin/Projekt/env/lib/python3.7/site-packages/django/db/models/query.py", line 325, in __getitem__
    return qs._result_cache[0]

Exception Type: IndexError at /userprofile/
Exception Value: list index out of range
kevinen98 commented 3 years ago

Kan vara så att Anna tog bort ett konto från datorn men var redan inloggad på mobilen sedan innan och har kvar sessionen. Från science loggen verkar det som att Anna har skapat 3 konton men 1 finns bara kvar.