2014-11-18 15:37:29 +00:00
|
|
|
open = require('open')
|
2014-11-18 16:15:40 +00:00
|
|
|
async = require('async')
|
2014-11-26 17:02:22 +00:00
|
|
|
resin = require('../resin')
|
2014-11-18 12:41:13 +00:00
|
|
|
|
|
|
|
exports.login = (credentials) ->
|
2014-11-18 16:15:40 +00:00
|
|
|
async.waterfall [
|
|
|
|
|
|
|
|
(callback) ->
|
|
|
|
if credentials?
|
2014-11-26 17:02:22 +00:00
|
|
|
return resin.auth.parseCredentials(credentials, callback)
|
2014-11-18 16:15:40 +00:00
|
|
|
else
|
2014-11-26 17:26:01 +00:00
|
|
|
return resin.ui.widgets.login(callback)
|
2014-11-18 16:15:40 +00:00
|
|
|
|
|
|
|
(credentials, callback) ->
|
2014-11-26 17:02:22 +00:00
|
|
|
resin.auth.login(credentials, callback)
|
2014-11-18 16:15:40 +00:00
|
|
|
|
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)
|