File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -34,4 +34,11 @@ export class ResponseError extends Error {
3434 responseCode : number ;
3535}
3636
37- export class OneTimePasswordError extends Error { }
37+ export class OneTimePasswordError extends Error {
38+ constructor ( notice : string ) {
39+ super ( ) ;
40+ this . notice = notice ;
41+ }
42+
43+ notice : string ;
44+ }
Original file line number Diff line number Diff line change @@ -191,6 +191,10 @@ export default class NpmRegistry extends Registry {
191191 }
192192
193193 this . reporter . info ( this . reporter . lang ( 'twoFactorAuthenticationEnabled' ) ) ;
194+ if ( error . notice ) {
195+ this . reporter . info ( error . notice ) ;
196+ }
197+
194198 this . otp = await getOneTimePassword ( this . reporter ) ;
195199
196200 this . requestManager . clearCache ( ) ;
Original file line number Diff line number Diff line change @@ -440,9 +440,8 @@ export default class RequestManager {
440440
441441 if ( res . statusCode === 401 && res . headers [ 'www-authenticate' ] ) {
442442 const authMethods = res . headers [ 'www-authenticate' ] . split ( / , \s * / ) . map ( s => s . toLowerCase ( ) ) ;
443-
444443 if ( authMethods . indexOf ( 'otp' ) !== - 1 ) {
445- reject ( new OneTimePasswordError ( ) ) ;
444+ reject ( new OneTimePasswordError ( res . headers [ 'npm-notice' ] ) ) ;
446445 return ;
447446 }
448447 }
You can’t perform that action at this time.
0 commit comments