mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-18 10:46:34 +00:00
Add optional interactivity to login command
This commit is contained in:
parent
275eed82f0
commit
24f50fa5ec
@ -1,10 +1,22 @@
|
|||||||
open = require('open')
|
open = require('open')
|
||||||
|
async = require('async')
|
||||||
auth = require('../auth/auth')
|
auth = require('../auth/auth')
|
||||||
|
widgets = require('../widgets/widgets')
|
||||||
config = require('../config')
|
config = require('../config')
|
||||||
|
|
||||||
exports.login = (credentials) ->
|
exports.login = (credentials) ->
|
||||||
parsedCredentials = auth.parseCredentials(credentials)
|
async.waterfall [
|
||||||
auth.login parsedCredentials, (error) ->
|
|
||||||
|
(callback) ->
|
||||||
|
if credentials?
|
||||||
|
return auth.parseCredentials(credentials, callback)
|
||||||
|
else
|
||||||
|
return widgets.login(callback)
|
||||||
|
|
||||||
|
(credentials, callback) ->
|
||||||
|
auth.login(credentials, callback)
|
||||||
|
|
||||||
|
], (error) ->
|
||||||
throw error if error?
|
throw error if error?
|
||||||
|
|
||||||
exports.logout = ->
|
exports.logout = ->
|
||||||
|
@ -10,7 +10,7 @@ program.version(packageJSON.version)
|
|||||||
auth = require('./actions/auth')
|
auth = require('./actions/auth')
|
||||||
|
|
||||||
program
|
program
|
||||||
.command('login <username:password>')
|
.command('login [username:password]')
|
||||||
.description('Login with your resin.io account')
|
.description('Login with your resin.io account')
|
||||||
.action(auth.login)
|
.action(auth.login)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user