File tree Expand file tree Collapse file tree 6 files changed +33
-11
lines changed
Model/Provider/Engine/U2fKey Expand file tree Collapse file tree 6 files changed +33
-11
lines changed Original file line number Diff line number Diff line change @@ -223,8 +223,6 @@ public function getPublicKeyFromRegistrationData(array $data): array
223
223
$ attestationObject = CBOREncoder::decode ($ byteString );
224
224
if (empty ($ attestationObject ['fmt ' ])
225
225
|| empty ($ attestationObject ['authData ' ])
226
- || $ attestationObject ['fmt ' ] === 'fido-u2f '
227
- || $ attestationObject ['fmt ' ] !== 'none ' && $ attestationObject ['fmt ' ] !== 'packed '
228
226
) {
229
227
throw new ValidationException (__ ('Invalid U2F key data ' ));
230
228
}
@@ -240,8 +238,8 @@ public function getPublicKeyFromRegistrationData(array $data): array
240
238
throw new ValidationException (__ ('Invalid U2F key data ' ));
241
239
}
242
240
243
- // User presence, attestation data, user verified
244
- if (!($ attestationObject ['flags ' ] & 0b1000011 )) {
241
+ // User presence, attestation data
242
+ if (!($ attestationObject ['flags ' ] & 0b1000001 )) {
245
243
throw new ValidationException (__ ('Invalid U2F key data ' ));
246
244
}
247
245
@@ -266,7 +264,8 @@ public function getPublicKeyFromRegistrationData(array $data): array
266
264
267
265
return [
268
266
'key ' => $ attestationObject ['attestationData ' ]['keyBytes ' ],
269
- 'id ' => $ data ['id ' ]
267
+ 'id ' => $ data ['id ' ],
268
+ 'aaguid ' => $ attestationObject ['attestationData ' ]['aaguid ' ] ?? null
270
269
];
271
270
}
272
271
Original file line number Diff line number Diff line change @@ -7,10 +7,7 @@ fieldset {
7
7
text-align : center;
8
8
}
9
9
10
- .tfa-u2f-touch-key {
11
- margin-bottom : 1em ;
12
- }
13
-
10
+ .tfa-u2f-touch-key ,
14
11
.tfa-u2f-try-again {
15
12
margin-bottom : 1em ;
16
13
}
Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ define([
18
18
19
19
defaults : {
20
20
template : 'Magento_TwoFactorAuth/u2fkey/auth' ,
21
- idle : ko . observable ( true )
21
+ idle : ko . observable ( true ) ,
22
+ loading : ko . observable ( false )
22
23
} ,
23
24
24
25
postUrl : '' ,
@@ -113,6 +114,7 @@ define([
113
114
* @private
114
115
*/
115
116
_processCredentialData : function ( credentialData ) {
117
+ this . loading ( true ) ;
116
118
$ . post ( this . getPostUrl ( ) , {
117
119
publicKeyCredential : {
118
120
type : credentialData . type ,
@@ -126,6 +128,8 @@ define([
126
128
}
127
129
} )
128
130
. done ( function ( res ) {
131
+ this . loading ( false ) ;
132
+
129
133
if ( res . success ) {
130
134
this . currentStep ( 'login' ) ;
131
135
self . location . href = this . getSuccessUrl ( ) ;
@@ -136,6 +140,7 @@ define([
136
140
} . bind ( this ) )
137
141
. fail ( function ( ) {
138
142
error . display ( $t ( 'Invalid key or key is not registered.' ) ) ;
143
+ this . loading ( false ) ;
139
144
this . idle ( true ) ;
140
145
} . bind ( this ) ) ;
141
146
} ,
Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ define([
18
18
19
19
defaults : {
20
20
template : 'Magento_TwoFactorAuth/u2fkey/configure' ,
21
- idle : ko . observable ( true )
21
+ idle : ko . observable ( true ) ,
22
+ loading : ko . observable ( false )
22
23
} ,
23
24
24
25
postUrl : '' ,
@@ -125,6 +126,7 @@ define([
125
126
return ;
126
127
}
127
128
129
+ this . loading ( true ) ;
128
130
$ . post ( this . getPostUrl ( ) , {
129
131
publicKeyCredential : {
130
132
id : utils . arrayBufferToBase64 ( credentialData . rawId ) ,
@@ -137,6 +139,8 @@ define([
137
139
}
138
140
} )
139
141
. done ( function ( res ) {
142
+ this . loading ( false ) ;
143
+
140
144
if ( res . success ) {
141
145
this . currentStep ( 'login' ) ;
142
146
self . location . href = this . getSuccessUrl ( ) ;
@@ -147,6 +151,7 @@ define([
147
151
} . bind ( this ) )
148
152
. fail ( function ( ) {
149
153
error . display ( $t ( 'Unable to register your device' ) ) ;
154
+ this . loading ( false ) ;
150
155
this . idle ( true ) ;
151
156
} . bind ( this ) ) ;
152
157
} ,
Original file line number Diff line number Diff line change @@ -27,4 +27,12 @@ <h3 translate="'Plug in your U2F key and follow instructions'"></h3>
27
27
</ div >
28
28
< div translate ="'Redirecting to Magento Admin Panel...' "> </ div >
29
29
</ div >
30
+ < div visible ='$data.loading ' class ="tfa-waitbox ">
31
+ < div data-role ="spinner ">
32
+ < div class ="spinner ">
33
+ < span /> < span /> < span /> < span /> < span /> < span /> < span /> < span />
34
+ </ div >
35
+ </ div >
36
+ < div translate ="'Loading...' "> </ div >
37
+ </ div >
30
38
</ div >
Original file line number Diff line number Diff line change @@ -27,4 +27,12 @@ <h3 translate="'Plug in your U2F key and follow instructions'"></h3>
27
27
</ div >
28
28
< div translate ="'Redirecting to Magento Admin Panel...' "> </ div >
29
29
</ div >
30
+ < div visible ='$data.loading ' class ="tfa-waitbox ">
31
+ < div data-role ="spinner ">
32
+ < div class ="spinner ">
33
+ < span /> < span /> < span /> < span /> < span /> < span /> < span /> < span />
34
+ </ div >
35
+ </ div >
36
+ < div translate ="'Loading...' "> </ div >
37
+ </ div >
30
38
</ div >
You can’t perform that action at this time.
0 commit comments