has been removed in django 2.0 https://docs.djangoproject.com/en/1.10/internals/deprecation/#deprecation-removed-in-2-0
21 lines
581 B
Python
21 lines
581 B
Python
import time
|
|
|
|
from django.conf import settings
|
|
from django.http import HttpResponseRedirect
|
|
from django.urls import reverse
|
|
|
|
|
|
def process(request):
|
|
next_check = request.session.get("mfa", {}).get("next_check", False)
|
|
if not next_check:
|
|
return None
|
|
now = int(time.time())
|
|
if now >= next_check:
|
|
method = request.session["mfa"]["method"]
|
|
path = request.META["PATH_INFO"]
|
|
return HttpResponseRedirect(
|
|
reverse(method + "_auth")
|
|
+ "?next=%s" % (settings.BASE_URL + path).replace("//", "/")
|
|
)
|
|
return None
|