2014-04-14 07:39:18 +08:00
|
|
|
bus = require './messagebus'
|
2014-04-14 08:16:37 +08:00
|
|
|
log = require './bbblogger'
|
2014-04-14 07:39:18 +08:00
|
|
|
|
2014-04-14 08:16:37 +08:00
|
|
|
exports.processLoginMessage = (data, callback) ->
|
|
|
|
bus.sendMessage(data, (err, result) ->
|
|
|
|
if (err)
|
|
|
|
errLog = {message: "Authentication Failure", reason: err, data: data}
|
|
|
|
log.error(JSON.stringify(errLog))
|
|
|
|
callback(err, null)
|
|
|
|
else
|
|
|
|
console.log("SUCCESS: #{result}")
|
|
|
|
if result.error?
|
|
|
|
callback(result.error, null)
|
2014-04-14 07:39:18 +08:00
|
|
|
else
|
2014-04-14 08:16:37 +08:00
|
|
|
callback(null, result.data)
|
|
|
|
)
|