From 53f936a2c683db5b66dee3b8692000e00ab30334 Mon Sep 17 00:00:00 2001 From: Mohamed El-Kalioby Date: Mon, 18 Jan 2021 18:53:11 +0300 Subject: [PATCH 1/5] Testing Touch ID --- mfa/static/mfa/js/ua-parser.min.js | 9 +++++++++ mfa/templates/FIDO2/Add.html | 15 +++++++++++++-- mfa/templates/FIDO2/recheck.html | 11 +++++++++-- setup.py | 3 ++- 4 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 mfa/static/mfa/js/ua-parser.min.js diff --git a/mfa/static/mfa/js/ua-parser.min.js b/mfa/static/mfa/js/ua-parser.min.js new file mode 100644 index 0000000..23e2d07 --- /dev/null +++ b/mfa/static/mfa/js/ua-parser.min.js @@ -0,0 +1,9 @@ +/*! + * UAParser.js v0.7.23 + * Lightweight JavaScript-based User-Agent string parser + * https://github.com/faisalman/ua-parser-js + * + * Copyright © 2012-2019 Faisal Salman + * Licensed under MIT License + */ +(function(window,undefined){"use strict";var LIBVERSION="0.7.23",EMPTY="",UNKNOWN="?",FUNC_TYPE="function",UNDEF_TYPE="undefined",OBJ_TYPE="object",STR_TYPE="string",MAJOR="major",MODEL="model",NAME="name",TYPE="type",VENDOR="vendor",VERSION="version",ARCHITECTURE="architecture",CONSOLE="console",MOBILE="mobile",TABLET="tablet",SMARTTV="smarttv",WEARABLE="wearable",EMBEDDED="embedded";var util={extend:function(regexes,extensions){var mergedRegexes={};for(var i in regexes){if(extensions[i]&&extensions[i].length%2===0){mergedRegexes[i]=extensions[i].concat(regexes[i])}else{mergedRegexes[i]=regexes[i]}}return mergedRegexes},has:function(str1,str2){if(typeof str1==="string"){return str2.toLowerCase().indexOf(str1.toLowerCase())!==-1}else{return false}},lowerize:function(str){return str.toLowerCase()},major:function(version){return typeof version===STR_TYPE?version.replace(/[^\d\.]/g,"").split(".")[0]:undefined},trim:function(str){return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}};var mapper={rgx:function(ua,arrays){var i=0,j,k,p,q,matches,match;while(i0){if(q.length==2){if(typeof q[1]==FUNC_TYPE){this[q[0]]=q[1].call(this,match)}else{this[q[0]]=q[1]}}else if(q.length==3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){this[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{this[q[0]]=match?match.replace(q[1],q[2]):undefined}}else if(q.length==4){this[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined}}else{this[q]=match?match:undefined}}}}i+=2}},str:function(str,map){for(var i in map){if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;j + {% endblock %} @@ -56,7 +67,7 @@
-

Your broswer should ask you to confirm you indentity.

+

Your browser should ask you to confirm you identity.

diff --git a/mfa/templates/FIDO2/recheck.html b/mfa/templates/FIDO2/recheck.html index 5fe9781..3871987 100644 --- a/mfa/templates/FIDO2/recheck.html +++ b/mfa/templates/FIDO2/recheck.html @@ -1,5 +1,6 @@ {% load static %} +
@@ -17,7 +18,9 @@
{% endif %} -

please press the button on your security key to prove it is you.

+
+

please press the button on your security key to prove it is you.

+
{% if mode == "auth" %}
@@ -101,7 +104,11 @@ $("#main_paragraph").addClass("alert alert-danger") $("#main_paragraph").html("FIDO2 must work under secure context") } else { - authen() + ua=UAParser() + if (ua.getBrowser().name == "Safari") + $("#res").html("") + else + authen() } }); diff --git a/setup.py b/setup.py index fdc621a..bd6a7d4 100644 --- a/setup.py +++ b/setup.py @@ -24,9 +24,10 @@ setup( 'ua-parser', 'user-agents', 'python-jose', - 'fido2 == 0.8.1', + # 'fido2 == 0.8.1', 'jsonLookup' ], + dependency_links =["https://github.com/Yubico/python-fido2/tarball/master"], python_requires=">=3.5", include_package_data=True, zip_safe=False, # because we're including static files From 66cf103bcaffd041315dd54c6fa63cd5c1c08e74 Mon Sep 17 00:00:00 2001 From: Mohamed El-Kalioby Date: Mon, 18 Jan 2021 19:12:12 +0300 Subject: [PATCH 2/5] Fixes --- mfa/templates/FIDO2/Add.html | 4 ++-- mfa/templates/FIDO2/recheck.html | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mfa/templates/FIDO2/Add.html b/mfa/templates/FIDO2/Add.html index 323521b..d80c9e0 100644 --- a/mfa/templates/FIDO2/Add.html +++ b/mfa/templates/FIDO2/Add.html @@ -42,8 +42,8 @@ }) } $(document).ready(function (){ - ua=new UAParser() - if (ua.getBrowser().name == "Safari") + ua=new UAParser().getResult() + if (ua.browser.name == "Safari") { $("#res").html("") } diff --git a/mfa/templates/FIDO2/recheck.html b/mfa/templates/FIDO2/recheck.html index 3871987..52568e2 100644 --- a/mfa/templates/FIDO2/recheck.html +++ b/mfa/templates/FIDO2/recheck.html @@ -1,6 +1,6 @@ {% load static %} - +
@@ -104,8 +104,8 @@ $("#main_paragraph").addClass("alert alert-danger") $("#main_paragraph").html("FIDO2 must work under secure context") } else { - ua=UAParser() - if (ua.getBrowser().name == "Safari") + ua=UAParser().getResult() + if (ua.browser.name == "Safari") $("#res").html("") else authen() From a577c80cc3276c27aa654d2e7d006aafad32da8c Mon Sep 17 00:00:00 2001 From: Mohamed El-Kalioby Date: Mon, 18 Jan 2021 19:31:23 +0300 Subject: [PATCH 3/5] Final touches --- mfa/__init__.py | 2 +- mfa/templates/FIDO2/Add.html | 4 ++-- mfa/templates/FIDO2/recheck.html | 2 +- setup.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mfa/__init__.py b/mfa/__init__.py index c5ce768..fa0705c 100644 --- a/mfa/__init__.py +++ b/mfa/__init__.py @@ -1 +1 @@ -__version__="2.0.5" +__version__="2.1.0b1" diff --git a/mfa/templates/FIDO2/Add.html b/mfa/templates/FIDO2/Add.html index d80c9e0..6ff10b9 100644 --- a/mfa/templates/FIDO2/Add.html +++ b/mfa/templates/FIDO2/Add.html @@ -45,7 +45,7 @@ ua=new UAParser().getResult() if (ua.browser.name == "Safari") { - $("#res").html("") + $("#res").html("") } else { @@ -66,7 +66,7 @@
-
+

Your browser should ask you to confirm you identity.

diff --git a/mfa/templates/FIDO2/recheck.html b/mfa/templates/FIDO2/recheck.html index 52568e2..3dc0609 100644 --- a/mfa/templates/FIDO2/recheck.html +++ b/mfa/templates/FIDO2/recheck.html @@ -104,7 +104,7 @@ $("#main_paragraph").addClass("alert alert-danger") $("#main_paragraph").html("FIDO2 must work under secure context") } else { - ua=UAParser().getResult() + ua=new UAParser().getResult() if (ua.browser.name == "Safari") $("#res").html("") else diff --git a/setup.py b/setup.py index bd6a7d4..fe3ceb3 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import find_packages, setup setup( name='django-mfa2', - version='2.0.5', + version='2.1.0b1', description='Allows user to add 2FA to their accounts', long_description=open("README.md").read(), long_description_content_type="text/markdown", From a94ad50b93421d08f54bc336e6b34bbf41362a5f Mon Sep 17 00:00:00 2001 From: Mohamed ElKalioby Date: Wed, 20 Jan 2021 16:05:08 +0300 Subject: [PATCH 4/5] Adding Latest mfa --- mfa/__init__.py | 2 +- setup.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mfa/__init__.py b/mfa/__init__.py index fa0705c..8eef514 100644 --- a/mfa/__init__.py +++ b/mfa/__init__.py @@ -1 +1 @@ -__version__="2.1.0b1" +__version__="2.1.0" diff --git a/setup.py b/setup.py index fe3ceb3..2e537ef 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import find_packages, setup setup( name='django-mfa2', - version='2.1.0b1', + version='2.1.0', description='Allows user to add 2FA to their accounts', long_description=open("README.md").read(), long_description_content_type="text/markdown", @@ -24,13 +24,12 @@ setup( 'ua-parser', 'user-agents', 'python-jose', - # 'fido2 == 0.8.1', + 'fido2 == 0.9', 'jsonLookup' ], - dependency_links =["https://github.com/Yubico/python-fido2/tarball/master"], python_requires=">=3.5", include_package_data=True, - zip_safe=False, # because we're including static files + zip_safe=False, # because we're including static files classifiers=[ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", From 87e83b3bbe07d2800205d165166d3c56b6b7235b Mon Sep 17 00:00:00 2001 From: Mohamed ElKalioby Date: Wed, 20 Jan 2021 16:06:34 +0300 Subject: [PATCH 5/5] Updated Changed Log --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a513482..ecd1b08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +## 2.1.0 + * Added Support for Touch ID for Mac OSx and iOS 14 on Safari + ## 2.0.5 * Fixed issue in __version__