Skip to content

Commit

Permalink
Closes #14
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalioby committed Jun 18, 2020
1 parent 9786f4a commit bc407ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions mfa/templates/MFA.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
$("#modal-footer").prepend("<button id='actionBtn' class='btn btn-danger' onclick='confirmDel("+id+")'>Confirm Deletion</button>")
$("#popUpModal").modal()
}
{% if not HIDE_DISABLE %}

function toggleKey(id) {
$.ajax({
url:"{% url 'toggle_key' %}?id="+id,
Expand All @@ -34,7 +34,6 @@
}
})
}
{% endif %}
</script>
<link href="{% static 'mfa/css/bootstrap-toggle.min.css' %}" rel="stylesheet">
<script src="{% static 'mfa/js/bootstrap-toggle.min.js'%}"></script>
Expand Down
9 changes: 6 additions & 3 deletions mfa/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ def toggleKey(request):
q=User_Keys.objects.filter(username=request.user.username, id=id)
if q.count()==1:
key=q[0]
key.enabled=not key.enabled
key.save()
return HttpResponse("OK")
if not key.key_type in settings.MFA_HIDE_DISABLE:
key.enabled=not key.enabled
key.save()
return HttpResponse("OK")
else:
return HttpResponse("You can't change this method.")
else:
return HttpResponse("Error")

Expand Down

0 comments on commit bc407ca

Please sign in to comment.