balena-cli/lib/actions/auth.coffee

24 lines
472 B
CoffeeScript
Raw Normal View History

2014-11-18 15:37:29 +00:00
open = require('open')
async = require('async')
2014-11-26 17:02:22 +00:00
resin = require('../resin')
exports.login = (credentials) ->
async.waterfall [
(callback) ->
if credentials?
2014-11-26 17:02:22 +00:00
return resin.auth.parseCredentials(credentials, callback)
else
2014-11-26 17:26:01 +00:00
return resin.ui.widgets.login(callback)
(credentials, callback) ->
2014-11-26 17:02:22 +00:00
resin.auth.login(credentials, callback)
2014-11-26 16:38:02 +00:00
], resin.errors.handle
2014-11-18 15:37:29 +00:00
2014-11-27 14:06:11 +00:00
exports.logout = ->
2014-11-26 17:02:22 +00:00
resin.auth.logout()
2014-11-18 15:48:05 +00:00
2014-11-18 15:37:29 +00:00
exports.signup = ->
2014-11-26 17:42:05 +00:00
open(resin.config.urls.signup)