Commit 7fb51e07 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[ui][views] Remove login related view since it's handled by the two_factor module

parent 86c24391
......@@ -31,7 +31,6 @@ import logging
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import views as auth_views
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import PasswordChangeForm
from django.contrib.auth.models import User
......@@ -42,7 +41,6 @@ from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from django.shortcuts import render
from django.template.loader import render_to_string
from django.urls import reverse
from rest_framework.authtoken.models import Token
from .. import __version__
......@@ -68,39 +66,6 @@ def index(request):
# ----------------------------------------------------------
class LoginView(auth_views.LoginView):
def post(self, request, *args, **kwargs):
authentication_match = False
try:
user = User.objects.get(username=request.POST["username"])
except User.DoesNotExist:
# No specific action is required here
# Possible future step: DOS/DDOS Brute-Force attack detection
pass
else:
authentication_match = user.check_password(request.POST["password"])
if authentication_match and user.profile.status == Profile.BLOCKED:
reactivation_url = request.build_absolute_uri(
reverse("blocked_user_reactivation")
)
context = {
"user": user,
"reactivation_url": reactivation_url,
}
mail.send_email(
"registration/mail.blocked_user_access_attempt.subject.txt",
"registration/mail.blocked_user_access_attempt.message.txt",
context,
[user.email],
)
return super().post(request, *args, **kwargs)
# ----------------------------------------------------------
def blocked_user_reactivation(request):
"""Reactivation page"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment