示例#1
0
def disable_mfa(request):
    user = request.user
    if not is_mfa_enabled(user):
        return HttpResponseRedirect(reverse("mfa:configure_mfa"))
    if request.method == "POST":
        user_mfa = user.userotp
        user_mfa.delete()
        return HttpResponseRedirect(reverse("mfa:configure_mfa"))
    return render(request, 'django_mfa/disable_mfa.html')
示例#2
0
def disable_mfa(request):
    user = request.user
    if not is_mfa_enabled(user):
        return HttpResponseRedirect(reverse("mfa:configure_mfa"))
    if request.method == "POST":
        user_mfa = user.userotp
        user_mfa.delete()
        messages.success(request, "You have successfully disabled multi-factor authentication on your account.")
        response = redirect(settings.LOGIN_REDIRECT_URL)
        return delete_rmb_cookie(request, response)
    return render(request, 'django_mfa/disable_mfa.html')
示例#3
0
def disable_mfa(request):
    user = request.user
    if not is_mfa_enabled(user):
        return HttpResponseRedirect(reverse("mfa:configure_mfa"))
    if request.method == "POST":
        user_mfa = user.userotp
        user_mfa.delete()
        messages.success(
            request,
            "You have successfully disabled multi-factor authentication on your account."
        )
        response = redirect(settings.LOGIN_REDIRECT_URL)
        return delete_rmb_cookie(request, response)
    return render(request, 'django_mfa/disable_mfa.html')
示例#4
0
def security_settings(request):
    twofactor_enabled = is_mfa_enabled(request.user)
    return render(request, 'django_mfa/security.html',
                  {"twofactor_enabled": twofactor_enabled})
示例#5
0
def security_settings(request):
    twofactor_enabled = is_mfa_enabled(request.user)
    return render(request, 'django_mfa/security.html', {"twofactor_enabled": twofactor_enabled})