Skip to content

Commit 21cf0ab

Browse files
jdeniauzkat
authored andcommitted
profile: better explanation on OTP (#24)
Use the defaut OTP explanation everywhere except when the context is "OTP-aware" (like when setting double-authentication) PR-URL: #24 Credit: @jdeniau Reviewed-By: @zkat
1 parent a9ac871 commit 21cf0ab

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/auth/legacy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function login (conf) {
5252
})
5353
.catch((err) => {
5454
if (err.code !== 'EOTP') throw err
55-
return read.otp('Authenticator provided OTP:').then((otp) => {
55+
return read.otp('Enter one-time password from your authenticator app: ').then((otp) => {
5656
conf.auth.otp = otp
5757
const u = conf.creds.username
5858
const p = conf.creds.password

lib/profile.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function set (args) {
195195
newUser[prop] = value
196196
return profile.set(newUser, conf).catch((err) => {
197197
if (err.code !== 'EOTP') throw err
198-
return readUserInfo.otp('Enter OTP: ').then((otp) => {
198+
return readUserInfo.otp().then((otp) => {
199199
conf.auth.otp = otp
200200
return profile.set(newUser, conf)
201201
})
@@ -262,7 +262,7 @@ function enable2fa (args) {
262262
return pulseTillDone.withPromise(profile.set({tfa: {password, mode: 'disable'}}, conf))
263263
} else {
264264
if (conf.auth.otp) return
265-
return readUserInfo.otp('Enter OTP: ').then((otp) => {
265+
return readUserInfo.otp('Enter one-time password from your authenticator app: ').then((otp) => {
266266
conf.auth.otp = otp
267267
})
268268
}

lib/token.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ function rm (args) {
164164
return profile.removeToken(key, conf).catch((ex) => {
165165
if (ex.code !== 'EOTP') throw ex
166166
log.info('token', 'failed because revoking this token requires OTP')
167-
return readUserInfo.otp('Authenticator provided OTP:').then((otp) => {
167+
return readUserInfo.otp().then((otp) => {
168168
conf.auth.otp = otp
169169
return profile.removeToken(key, conf)
170170
})
@@ -192,7 +192,7 @@ function create (args) {
192192
return profile.createToken(password, readonly, validCIDR, conf).catch((ex) => {
193193
if (ex.code !== 'EOTP') throw ex
194194
log.info('token', 'failed because it requires OTP')
195-
return readUserInfo.otp('Authenticator provided OTP:').then((otp) => {
195+
return readUserInfo.otp().then((otp) => {
196196
conf.auth.otp = otp
197197
log.info('token', 'creating with OTP')
198198
return pulseTillDone.withPromise(profile.createToken(password, readonly, validCIDR, conf))

0 commit comments

Comments
 (0)