diff --git a/README.md b/README.md
index 71886d7..b80f83c 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,8 @@ Depends on
MFA_RECHECK=True # Allow random rechecking of the user
MFA_RECHECK_MIN=10 # Minimum interval in seconds
MFA_RECHECK_MAX=30 # Maximum in seconds
- MFA_QUICKLOGIN=True # Allow quick login for returning users by provide only their 2FA
+ MFA_QUICKLOGIN=True # Allow quick login for returning users by provide only their 2FA
+ MFA_HIDE_DISABLE=('FIDO2',) # Can the user disable his key (Added in 1.2.0).
TOKEN_ISSUER_NAME="PROJECT_NAME" #TOTP Issuer name
diff --git a/mfa/CHANGELOG.md b/mfa/CHANGELOG.md
new file mode 100644
index 0000000..a3d7611
--- /dev/null
+++ b/mfa/CHANGELOG.md
@@ -0,0 +1,4 @@
+# Change Log
+
+## v1.2.0
+ * Added: MFA_HIDE_DISABLE setting option to disable users from deactivating their keys.
\ No newline at end of file
diff --git a/mfa/templates/MFA.html b/mfa/templates/MFA.html
index da1c785..f026a36 100644
--- a/mfa/templates/MFA.html
+++ b/mfa/templates/MFA.html
@@ -20,6 +20,7 @@
$("#modal-footer").prepend("")
$("#popUpModal").modal()
}
+ {% if not HIDE_DISABLE %}
function toggleKey(id) {
$.ajax({
url:"{% url 'toggle_key' %}?id="+id,
@@ -33,6 +34,7 @@
}
})
}
+ {% endif %}
@@ -87,7 +89,11 @@
{{ key.expires }}
{% if key.device %}{{ key.device }}{% endif %}
{{ key.last_used }}
-
+ {% if key.key_type in HIDE_DISABLE %}
+
{% if key.enabled %}On{% else %} Off{% endif %}
+ {% else %}
+
+ {% endif %}
{% empty %}
diff --git a/mfa/views.py b/mfa/views.py
index c90fd0b..1cd3275 100644
--- a/mfa/views.py
+++ b/mfa/views.py
@@ -12,14 +12,15 @@ from . import TrustedDevice
from user_agents import parse
def index(request):
keys=[]
- context={"keys":User_Keys.objects.filter(username=request.user.username),"UNALLOWED_AUTHEN_METHODS":settings.MFA_UNALLOWED_METHODS}
+ context={"keys":User_Keys.objects.filter(username=request.user.username),"UNALLOWED_AUTHEN_METHODS":settings.MFA_UNALLOWED_METHODS
+ ,"HIDE_DISABLE":getattr(settings,"MFA_HIDE_DISABLE",[])}
for k in context["keys"]:
if k.key_type =="Trusted Device" :
setattr(k,"device",parse(k.properties.get("user_agent","-----")))
elif k.key_type == "FIDO2":
setattr(k,"device",k.properties.get("type","----"))
keys.append(k)
- context["keys"]=keys
+ context["keys"]=keys
return render_to_response("MFA.html",context,context_instance=RequestContext(request))
def verify(request,username):
diff --git a/setup.py b/setup.py
index a411d12..86cc19c 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ from setuptools import find_packages, setup
setup(
name='django-mfa2',
- version='1.1.8',
+ version='1.2.0',
description='Allows user to add 2FA to their accounts',
long_description=open("README.md").read(),
long_description_content_type="text/markdown",