@@ -20,7 +20,10 @@ const INVITE_REQUEST_DIR = 'inviteRequests';
20
20
const ADMIN_INVITE_DIR_NAME = 'invites' ;
21
21
const CONTACT_URL_DIR = 'contactUrls' ;
22
22
const HOST_IDENTITY = 'psteniusubi.github.io' ;
23
- const { mockAccountFactory, CREDENTIAL_PRESENTED_RIGHT , CREDENTIAL_PRESENTED_WRONG , USER } = require ( '../util/mockAccount' ) ;
23
+ const {
24
+ mockAccountFactory, CREDENTIAL_PRESENTED_RIGHT , CREDENTIAL_PRESENTED_WRONG , USER ,
25
+ CREDENTIAL_PRESENTED_RIGHT_NO_USERHANDLE
26
+ } = require ( '../util/mockAccount' ) ;
24
27
const crypto = require ( 'crypto' ) ;
25
28
const loginFactory = require ( '../../lib/routes/login' ) ;
26
29
const NoSuchBlobError = require ( '../../lib/util/NoSuchBlobError' ) ;
@@ -516,6 +519,17 @@ describe('admin module', function () {
516
519
expect ( verifyRes . body . verified ) . to . equal ( true ) ;
517
520
expect ( verifyRes . body . username ) . to . equal ( USER . username ) ;
518
521
} ) ;
522
+
523
+ it ( 'accepts a registered passkey w/o userHandle when already logged in' , async function ( ) {
524
+ this . sessionValues . loginChallenge = LOGIN_CHALLENGE ;
525
+ this . sessionValues . user = structuredClone ( USER ) ;
526
+ const verifyRes = await chai . request ( this . app ) . post ( '/admin/verify-authentication' )
527
+ . type ( 'application/json' ) . send ( JSON . stringify ( CREDENTIAL_PRESENTED_RIGHT_NO_USERHANDLE ) ) ;
528
+ expect ( verifyRes ) . to . have . status ( 200 ) ;
529
+ expect ( verifyRes ) . to . be . json ;
530
+ expect ( verifyRes . body . verified ) . to . equal ( true ) ;
531
+ expect ( verifyRes . body . username ) . to . equal ( USER . username ) ;
532
+ } ) ;
519
533
} ) ;
520
534
521
535
describe ( 'users list' , function ( ) {
0 commit comments