diff --git a/api/urls.py b/api/urls.py index 452f24d..57c1c7f 100644 --- a/api/urls.py +++ b/api/urls.py @@ -13,6 +13,6 @@ urlpatterns = [ path('chatnewmessage/', views.savenewchatmessage, name='api-savechatmessage'), # MIGRATION path('migrateagencyusers/', views.migrateAgencyUsers, name="api-migrateagencyusers"), - path('test/', views.test, name="api-test"), - + # EXTERNAL FROM NC + path('logout/', views.test, name="api-test"), ] \ No newline at end of file diff --git a/api/views.py b/api/views.py index b7be5e0..d8ad999 100644 --- a/api/views.py +++ b/api/views.py @@ -91,6 +91,11 @@ def migrateAgencyUsers(request, pk): from django.contrib.auth import login, logout +from django.contrib.auth import update_session_auth_hash +from django.contrib.sessions.models import Session + @api_view(['GET', ]) -def test(request): - return redirect('users-logout') +def test(request, uid): + user = User.objects.get(username=uid) + [s.delete() for s in Session.objects.all() if s.get_decoded().get('_auth_user_hash') == user.get_session_auth_hash()] + return JsonResponse({'res' : 'ok'}) diff --git a/digitaleagentur/__pycache__/settings.cpython-38.pyc b/digitaleagentur/__pycache__/settings.cpython-38.pyc index 8684589..f5c36eb 100644 Binary files a/digitaleagentur/__pycache__/settings.cpython-38.pyc and b/digitaleagentur/__pycache__/settings.cpython-38.pyc differ diff --git a/digitaleagentur/settings.py b/digitaleagentur/settings.py index db04c8d..4afd8b8 100644 --- a/digitaleagentur/settings.py +++ b/digitaleagentur/settings.py @@ -25,10 +25,10 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Nach zehn Stunden läuft der Cookie ab! # TASK: Zehn stunden auto-auslog einmal checken Sekunden! -SESSION_COOKIE_AGE = 8*60*60 +SESSION_COOKIE_AGE = 100*60*60 -CHANNELS_PRESENCE_MAX_AGE = 30 +#CHANNELS_PRESENCE_MAX_AGE = 30 # FOR SUMMERNOTE ORIGIN X_FRAME_OPTIONS = 'ALLOWALL' @@ -115,7 +115,7 @@ MIDDLEWARE = [ ROOT_URLCONF = 'digitaleagentur.urls' -CSRF_COOKIE_SECURE = False +#CSRF_COOKIE_SECURE = False TEMPLATES = [ { diff --git a/requirements.txt b/requirements.txt index 38bc954..80ab509 100644 --- a/requirements.txt +++ b/requirements.txt @@ -37,4 +37,5 @@ django-simple-captcha==0.5.13 auditlog3==1.0.1 filetype==1.0.7 Authlib==0.15.3 -xmltodict==0.12.0 \ No newline at end of file +xmltodict==0.12.0 +django-user-sessions==1.7.1 \ No newline at end of file diff --git a/users/templates/users/base.html b/users/templates/users/base.html index 848b123..4ad24bd 100644 --- a/users/templates/users/base.html +++ b/users/templates/users/base.html @@ -271,23 +271,24 @@ - + + -
+ + -