Skip to content

Commit ad07241

Browse files
committed
Merge branch 'develop' into Tier4-PR-Delivery-11-18-23
2 parents 4e17e9c + 5c6d694 commit ad07241

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ define([
8484
*/
8585
waitForTouch: function () {
8686
this.idle(false);
87+
if (!navigator.credentials) {
88+
this.currentStep('no-webauthn');
89+
return;
90+
}
8791
navigator.credentials.get({
8892
publicKey: this.authenticateData.credentialRequestOptions
8993
})
@@ -158,8 +162,8 @@ define([
158162
_onCredentialError: function (u2fError) {
159163
this.idle(true);
160164

161-
if (['AbortError', 'NS_ERROR_ABORT', 'NotAllowedError'].indexOf(u2fError.name) === -1) {
162-
error.display($t('Unable to register your device'));
165+
if (['AbortError', 'NS_ERROR_ABORT'].indexOf(u2fError.name) === -1) {
166+
error.display($t(u2fError.message));
163167
}
164168
}
165169
});

TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ define([
7878
*/
7979
waitForTouch: function () {
8080
this.idle(false);
81+
if (!navigator.credentials) {
82+
this.currentStep('no-webauthn');
83+
return;
84+
}
8185
navigator.credentials.create({
8286
publicKey: this.registerData.publicKey
8387
})
@@ -150,8 +154,8 @@ define([
150154
_onCredentialError: function (u2fError) {
151155
this.idle(true);
152156

153-
if (['AbortError', 'NS_ERROR_ABORT', 'NotAllowedError'].indexOf(u2fError.name) === -1) {
154-
error.display($t('Unable to register your device'));
157+
if (['AbortError', 'NS_ERROR_ABORT'].indexOf(u2fError.name) === -1) {
158+
error.display($t(u2fError.message));
155159
}
156160
}
157161
});

TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<fieldset class="admin__fieldset">
1010
<legend class="admin__legend">
1111
<span translate="'2FA - U2F key verification'"></span>
12-
</legend><br/>
12+
</legend><br>
1313
<div class="tfa-u2f-touch-key">
1414
<h3 translate="'Plug in your U2F key and follow instructions'"></h3>
1515
<div visible="$data.idle" class="tfa-u2f-try-again">
@@ -27,6 +27,10 @@ <h3 translate="'Plug in your U2F key and follow instructions'"></h3>
2727
</div>
2828
<div translate="'Redirecting to Magento Admin Panel...'"></div>
2929
</div>
30+
<div visible='currentStep() === "no-webauthn"'
31+
translate="'Error! Your browser does not support WebAuthn or you are not using a secure connection'"
32+
>
33+
</div>
3034
<div visible='$data.loading' class="tfa-waitbox">
3135
<div data-role="spinner">
3236
<div class="spinner">

TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<fieldset class="admin__fieldset">
1010
<legend class="admin__legend">
1111
<span translate="'2FA - U2F key device registration'"></span>
12-
</legend><br/>
12+
</legend><br>
1313
<div id="u2f-touch-key">
1414
<h3 translate="'Plug in your U2F key and follow instructions'"></h3>
1515
<div visible="$data.idle" class="tfa-u2f-try-again">
@@ -27,6 +27,10 @@ <h3 translate="'Plug in your U2F key and follow instructions'"></h3>
2727
</div>
2828
<div translate="'Redirecting to Magento Admin Panel...'"></div>
2929
</div>
30+
<div visible='currentStep() === "no-webauthn"'
31+
translate="'Error! Your browser does not support WebAuthn or you are not using a secure connection'"
32+
>
33+
</div>
3034
<div visible='$data.loading' class="tfa-waitbox">
3135
<div data-role="spinner">
3236
<div class="spinner">

0 commit comments

Comments
 (0)