Skip to content
Snippets Groups Projects
Commit 6621f2e2 authored by Jean-Philippe Laverdure's avatar Jean-Philippe Laverdure
Browse files

updates requirements

parent 7aa66d23
No related branches found
No related tags found
No related merge requests found
from django.contrib import admin from django.contrib import admin
from portal.models import Profile
# Register your models here. # Register your models here.
admin.site.register(Profile)
import copy import copy
import logging
from django.contrib.auth.mixins import UserPassesTestMixin from django.contrib.auth import authenticate, login
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.contrib.messages.views import SuccessMessageMixin from django.contrib.messages.views import SuccessMessageMixin
from django.http import JsonResponse from django.http import JsonResponse
from django.utils import translation from django.utils import translation
...@@ -9,21 +11,21 @@ from django.views.generic import ListView ...@@ -9,21 +11,21 @@ from django.views.generic import ListView
from django.views.generic.base import ContextMixin from django.views.generic.base import ContextMixin
from django.views.generic.detail import BaseDetailView, SingleObjectMixin from django.views.generic.detail import BaseDetailView, SingleObjectMixin
from django.views.generic.edit import ModelFormMixin from django.views.generic.edit import ModelFormMixin
from django.contrib.auth import login, authenticate from portal.models import AppSettings, DataFile, Lab, Log, Profile, ShareGroup
from django.contrib.auth.mixins import LoginRequiredMixin
logger = logging.getLogger('debug')
from ..models import (AppSettings, DataFile, DataSet, Lab, Log, Profile,
ShareGroup)
class TokenLoginMixin(LoginRequiredMixin): class TokenLoginMixin(LoginRequiredMixin):
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
if not request.user.is_authenticated: if not request.user.is_authenticated:
user = authenticate(request) user = authenticate(request)
logger.debug(user)
if user: if user:
login(request, user) login(request, user)
else: else:
return JsonResponse({'error': _('Malformed authorization header or invalid token')}, status=401) return JsonResponse({'error': _('Malformed authorization header or invalid token')}, status=401)
return super().dispatch(request, *args, **kwargs) return super().dispatch(request, *args, **kwargs)
......
...@@ -15,7 +15,8 @@ flake8==3.6.0 ...@@ -15,7 +15,8 @@ flake8==3.6.0
idna==2.8 idna==2.8
mccabe==0.6.1 mccabe==0.6.1
oauthlib==3.1.0 oauthlib==3.1.0
Pillow==8.1.0 Pillow==8.3.1
promise==2.3
psycopg2-binary==2.8.4 psycopg2-binary==2.8.4
pyasn1==0.4.4 pyasn1==0.4.4
pyasn1-modules==0.2.2 pyasn1-modules==0.2.2
...@@ -33,4 +34,6 @@ six==1.12.0 ...@@ -33,4 +34,6 @@ six==1.12.0
social-auth-app-django==3.1.0 social-auth-app-django==3.1.0
social-auth-core==3.3.3 social-auth-core==3.3.3
SQLAlchemy==0.8.3 SQLAlchemy==0.8.3
sqlparse==0.4.1
text-unidecode==1.3
urllib3==1.24.1 urllib3==1.24.1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment