From 06b92ac74b4865332f6a7ede23a7fbcbf3031ae1 Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Mon, 1 Jun 2020 08:23:14 +0000 Subject: [PATCH] remove obsolete view --- api/tacticalrmm/accounts/views.py | 26 ++------------------------ api/tacticalrmm/tacticalrmm/urls.py | 3 +-- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/api/tacticalrmm/accounts/views.py b/api/tacticalrmm/accounts/views.py index 93db2412..1e640360 100644 --- a/api/tacticalrmm/accounts/views.py +++ b/api/tacticalrmm/accounts/views.py @@ -5,17 +5,11 @@ from django.conf import settings from rest_framework.authtoken.serializers import AuthTokenSerializer from knox.views import LoginView as KnoxLoginView -from rest_framework.authentication import BasicAuthentication -from rest_framework.permissions import IsAuthenticated, AllowAny +from rest_framework.permissions import AllowAny from rest_framework.response import Response from rest_framework import status -from rest_framework.decorators import ( - api_view, - authentication_classes, - permission_classes, -) -from accounts.models import User +from .models import User class CheckCreds(KnoxLoginView): @@ -52,19 +46,3 @@ class LoginView(KnoxLoginView): return super(LoginView, self).post(request, format=None) else: return Response("bad credentials", status=status.HTTP_400_BAD_REQUEST) - - -@api_view(["POST"]) -@authentication_classes((BasicAuthentication,)) -@permission_classes((IsAuthenticated,)) -def installer_twofactor(request): - - token = request.data["twofactorToken"] - totp = pyotp.TOTP(request.user.totp_key) - - if settings.DEBUG and token == "sekret": - return Response("ok") - elif totp.verify(token, valid_window=1): - return Response("ok") - else: - return Response("bad 2 factor code", status=status.HTTP_400_BAD_REQUEST) diff --git a/api/tacticalrmm/tacticalrmm/urls.py b/api/tacticalrmm/tacticalrmm/urls.py index 68f820aa..4a48b431 100644 --- a/api/tacticalrmm/tacticalrmm/urls.py +++ b/api/tacticalrmm/tacticalrmm/urls.py @@ -2,7 +2,7 @@ from django.contrib import admin from django.urls import path, include from django.conf import settings from knox import views as knox_views -from accounts.views import LoginView, CheckCreds, installer_twofactor +from accounts.views import LoginView, CheckCreds urlpatterns = [ path(settings.ADMIN_URL, admin.site.urls), @@ -10,7 +10,6 @@ urlpatterns = [ path("login/", LoginView.as_view()), path("logout/", knox_views.LogoutView.as_view()), path("logoutall/", knox_views.LogoutAllView.as_view()), - path("installer/twofactor/", installer_twofactor), path("api/v1/", include("api.urls")), path("clients/", include("clients.urls")), path("agents/", include("agents.urls")),