mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-26 22:10:11 +00:00
Implement signup command
This commit is contained in:
parent
612bb5e605
commit
5c53829812
@ -1,6 +1,11 @@
|
||||
open = require('open')
|
||||
auth = require('../auth/auth')
|
||||
config = require('../config')
|
||||
|
||||
exports.login = (credentials) ->
|
||||
parsedCredentials = auth.parseCredentials(credentials)
|
||||
auth.login parsedCredentials, (error) ->
|
||||
throw error if error?
|
||||
|
||||
exports.signup = ->
|
||||
open(config.urls.signup)
|
||||
|
@ -8,11 +8,20 @@ app = require('./actions/app')
|
||||
|
||||
program.version(packageJSON.version)
|
||||
|
||||
# ---------- Auth Module ----------
|
||||
|
||||
program
|
||||
.command('login <username:password>')
|
||||
.description('Login with your resin.io account')
|
||||
.action(auth.login)
|
||||
|
||||
program
|
||||
.command('signup')
|
||||
.description('Open signup form')
|
||||
.action(auth.signup)
|
||||
|
||||
# ---------- App Module ----------
|
||||
|
||||
program
|
||||
.command('apps')
|
||||
.description('Show a list of your apps')
|
||||
|
@ -1,8 +1,19 @@
|
||||
_ = require('lodash')
|
||||
url = require('url')
|
||||
path = require('path')
|
||||
|
||||
module.exports =
|
||||
config =
|
||||
|
||||
# TODO: Should be configurable
|
||||
remoteUrl: 'https://staging.resin.io'
|
||||
apiPrefix: '/ewa/'
|
||||
dataPrefix: path.join(process.env.HOME, '.resin')
|
||||
|
||||
config.urls =
|
||||
signup: '/signup'
|
||||
|
||||
# Append config.remoteUrl before every url
|
||||
config.urls = _.object _.map config.urls, (value, key, object) ->
|
||||
return [ key, url.resolve(config.remoteUrl, value) ]
|
||||
|
||||
module.exports = config
|
||||
|
@ -33,6 +33,7 @@
|
||||
"commander": "~2.5.0",
|
||||
"mkdirp": "~0.5.0",
|
||||
"resin-platform-api": "git+ssh://git@bitbucket.org/rulemotion/resin-platform-api.git#master",
|
||||
"bluebird": "~2.3.11"
|
||||
"bluebird": "~2.3.11",
|
||||
"open": "0.0.5"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user