diff --git a/mfa/templates/FIDO2/Auth_JS.html b/mfa/templates/FIDO2/Auth_JS.html
index 3bdfba0..f19daea 100644
--- a/mfa/templates/FIDO2/Auth_JS.html
+++ b/mfa/templates/FIDO2/Auth_JS.html
@@ -12,8 +12,11 @@ var GetAssertReq = (getAssert) => {
return getAssert
}
- function authen()
+ function authen(conditionalUI=false)
{
+ if (window.hasOwnProperty("getCredSignal"))
+ window.getCredSignal.abort('Restarting');
+ window.getCredSignal = new AbortController();
fetch('{% url 'fido2_begin_auth' %}', {
method: 'GET',
}).then(function(response) {
@@ -25,10 +28,11 @@ var GetAssertReq = (getAssert) => {
throw new Error('No credential available to authenticate!');
}).then(function(options) {
console.log(options)
- {% if conditionalUI %}
- options["mediation"] = 'conditional';
- {% endif %}
- return navigator.credentials.get(options);
+ if (conditionalUI) {
+ options.mediation = 'conditional';
+ }
+ options.signal = window.getCredSignal.signal;
+ return navigator.credentials.get(options);
}).then(function(assertion) {
diff --git a/mfa/templates/FIDO2/FormFill.html b/mfa/templates/FIDO2/FormFill.html
index f4d39e1..33a2648 100644
--- a/mfa/templates/FIDO2/FormFill.html
+++ b/mfa/templates/FIDO2/FormFill.html
@@ -7,9 +7,9 @@
// Check if conditional mediation is available.
const isCMA = await PublicKeyCredential.isConditionalMediationAvailable()
if (isCMA) {
- authen();
+ authen(true);
}
}
})
-{% include 'FIDO2/Auth_JS.html' with conditionalUI=True %}
+{% include 'FIDO2/Auth_JS.html' %}