kumidc/authentication/views/otp.py

16 lines
532 B
Python
Raw Normal View History

2022-08-04 11:15:10 +00:00
from django.contrib.auth.views import LoginView
from django.utils import timezone
from ..forms.otp import TOTPLoginForm
from ..mixins.session import AuthSessionRequiredMixin
from frontend.mixins.views import TitleMixin
class TOTPLoginView(TitleMixin, AuthSessionRequiredMixin, LoginView):
form_class = TOTPLoginForm
title = "Verify"
2022-08-04 12:11:55 +00:00
template_name = "auth/totplogin.html"
2022-08-04 11:15:10 +00:00
def form_valid(self, form):
self.request.session["LastActivity"] = timezone.now().timestamp()
return super().form_valid(form)