Testing Touch ID

This commit is contained in:
Mohamed El-Kalioby
2021-01-18 18:53:11 +03:00
parent 6f4c3e0486
commit 53f936a2c6
4 changed files with 33 additions and 5 deletions

9
mfa/static/mfa/js/ua-parser.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -2,6 +2,7 @@
{% load static %} {% load static %}
{% block head %} {% block head %}
<script type="application/javascript" src="{% static 'mfa/js/cbor.js'%}"></script> <script type="application/javascript" src="{% static 'mfa/js/cbor.js'%}"></script>
<script type="application/javascript" src="{% static 'mfa/js/ua-parser.min.js'%}"></script>
<script type="application/javascript"> <script type="application/javascript">
function begin_reg(){ function begin_reg(){
fetch('{% url 'fido2_begin_reg' %}',{}).then(function(response) { fetch('{% url 'fido2_begin_reg' %}',{}).then(function(response) {
@@ -40,7 +41,17 @@
$("#res").html("<div class='alert alert-danger'>Registeration Failed as " +reason +", <a href='javascript:void(0)' onclick='begin_reg()'> try again </a> or <a href='{% url 'mfa_home' %}'> Go to Security Home</a></div>") $("#res").html("<div class='alert alert-danger'>Registeration Failed as " +reason +", <a href='javascript:void(0)' onclick='begin_reg()'> try again </a> or <a href='{% url 'mfa_home' %}'> Go to Security Home</a></div>")
}) })
} }
$(document).ready(setTimeout(begin_reg,500)) $(document).ready(function (){
ua=new UAParser()
if (ua.getBrowser().name == "Safari")
{
$("#res").html("<button class='btn btn-primary' onclick='begin_reg()'>Start...</button>")
}
else
{
setTimeout(begin_reg, 500)
}
})
</script> </script>
{% endblock %} {% endblock %}
@@ -56,7 +67,7 @@
<div class="row alert alert-pr" id="res"> <div class="row alert alert-pr" id="res">
<p style="color: green">Your broswer should ask you to confirm you indentity.</p> <p style="color: green">Your browser should ask you to confirm you identity.</p>
</div> </div>
</div> </div>

View File

@@ -1,5 +1,6 @@
{% load static %} {% load static %}
<script type="application/javascript" src="{% static 'mfa/js/cbor.js' %}"></script> <script type="application/javascript" src="{% static 'mfa/js/cbor.js' %}"></script>
<script type="application/javascript" src="{% static 'mfa/js/us-parser.min.js' %}"></script>
<div class="row"> <div class="row">
<div class="col-sm-10 col-sm-offset-1 col-xs-12 col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2"> <div class="col-sm-10 col-sm-offset-1 col-xs-12 col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
@@ -17,7 +18,9 @@
<br/> <br/>
{% endif %} {% endif %}
<p style="color: green">please press the button on your security key to prove it is you.</p> <div id="res">
<p style="color: green">please press the button on your security key to prove it is you.</p>
</div>
<div id="msgdiv"></div> <div id="msgdiv"></div>
{% if mode == "auth" %} {% if mode == "auth" %}
<form id="u2f_login" action="{% url 'fido2_complete_auth' %}" method="post" enctype="multipart/form-data"> <form id="u2f_login" action="{% url 'fido2_complete_auth' %}" method="post" enctype="multipart/form-data">
@@ -101,7 +104,11 @@
$("#main_paragraph").addClass("alert alert-danger") $("#main_paragraph").addClass("alert alert-danger")
$("#main_paragraph").html("FIDO2 must work under secure context") $("#main_paragraph").html("FIDO2 must work under secure context")
} else { } else {
authen() ua=UAParser()
if (ua.getBrowser().name == "Safari")
$("#res").html("<button class='btn btn-success' onclick='authen()'>Authenticate...</button>")
else
authen()
} }
}); });

View File

@@ -24,9 +24,10 @@ setup(
'ua-parser', 'ua-parser',
'user-agents', 'user-agents',
'python-jose', 'python-jose',
'fido2 == 0.8.1', # 'fido2 == 0.8.1',
'jsonLookup' 'jsonLookup'
], ],
dependency_links =["https://github.com/Yubico/python-fido2/tarball/master"],
python_requires=">=3.5", python_requires=">=3.5",
include_package_data=True, include_package_data=True,
zip_safe=False, # because we're including static files zip_safe=False, # because we're including static files