Skip to content

Commit

Permalink
fix: remove unnecessary logging for webauthn auth
Browse files Browse the repository at this point in the history
  • Loading branch information
hfaulds committed Jun 24, 2022
1 parent 0ce09f1 commit 4f2bf86
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions lib/auth/legacy.js
Expand Up @@ -2,6 +2,7 @@ const profile = require('npm-profile')
const log = require('../utils/log-shim')
const openUrlPrompt = require('../utils/open-url-prompt.js')
const read = require('../utils/read-user-info.js')
const replaceInfo = require('../utils/replace-info.js')

const loginPrompter = async (creds) => {
creds.username = await read.username('Username:', creds.username)
Expand All @@ -14,6 +15,10 @@ const loginPrompter = async (creds) => {
const login = async (npm, opts) => {
let res

if (opts.authType === 'legacy') {
log.notice('', `Log in on ${replaceInfo(opts.registry)}`)
}

const requestOTP = async () => {
const otp = await read.otp(
'Enter one-time password: '
Expand Down
3 changes: 3 additions & 0 deletions lib/auth/sso.js
Expand Up @@ -12,6 +12,7 @@ const npmFetch = require('npm-registry-fetch')
const log = require('../utils/log-shim')
const openUrl = require('../utils/open-url.js')
const otplease = require('../utils/otplease.js')
const replaceInfo = require('../utils/replace-info.js')

const pollForSession = ({ registry, token, opts }) => {
log.info('adduser', 'Polling for validated SSO session')
Expand Down Expand Up @@ -39,6 +40,8 @@ const login = async (npm, { creds, registry, scope }) => {
const opts = { ...npm.flatOptions, creds, registry, scope }
const { ssoType } = opts

log.notice('', `Log in on ${replaceInfo(registry)}`)

if (!ssoType) {
throw new Error('Missing option: sso-type')
}
Expand Down
Empty file added lib/auth/webauthn.js
Empty file.
5 changes: 1 addition & 4 deletions lib/commands/adduser.js
@@ -1,9 +1,8 @@
const log = require('../utils/log-shim.js')
const replaceInfo = require('../utils/replace-info.js')
const BaseCommand = require('../base-command.js')
const authTypes = {
legacy: require('../auth/legacy.js'),
webauthn: require('../auth/legacy.js'),
webauthn: require('../auth/webauthn.js'),
oauth: require('../auth/oauth.js'),
saml: require('../auth/saml.js'),
sso: require('../auth/sso.js'),
Expand All @@ -28,8 +27,6 @@ class AddUser extends BaseCommand {

log.disableProgress()

log.notice('', `Log in on ${replaceInfo(registry)}`)

const { message, newCreds } = await auth(this.npm, {
...this.npm.flatOptions,
creds,
Expand Down

0 comments on commit 4f2bf86

Please sign in to comment.