mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 13:47:52 +00:00
28 lines
604 B
CoffeeScript
28 lines
604 B
CoffeeScript
url = require('url')
|
|
open = require('open')
|
|
async = require('async')
|
|
resin = require('../resin')
|
|
ui = require('../ui')
|
|
|
|
exports.login = (credentials) ->
|
|
async.waterfall [
|
|
|
|
(callback) ->
|
|
if credentials?
|
|
return resin.auth.parseCredentials(credentials, callback)
|
|
else
|
|
return ui.widgets.login(callback)
|
|
|
|
(credentials, callback) ->
|
|
resin.auth.login(credentials, callback)
|
|
|
|
], resin.errors.handle
|
|
|
|
exports.logout = ->
|
|
resin.auth.logout()
|
|
|
|
exports.signup = ->
|
|
signupUrl = resin.settings.get('urls.signup')
|
|
absUrl = url.resolve(resin.settings.get('remoteUrl'), signupUrl)
|
|
open(absUrl)
|