HOTFIX: isLoggedIn now returns a possible error

This commit is contained in:
Juan Cruz Viotti 2015-06-11 12:40:49 -04:00
parent 73736abdea
commit 7e5ecd634d
2 changed files with 6 additions and 2 deletions

View File

@ -18,7 +18,10 @@
update = require('./update');
capitano.permission('user', function(done) {
return resin.auth.isLoggedIn(function(isLoggedIn) {
return resin.auth.isLoggedIn(function(error, isLoggedIn) {
if (error != null) {
return done(error);
}
if (!isLoggedIn) {
return done(new Error('You have to log in'));
}

View File

@ -8,7 +8,8 @@ plugins = require('./plugins')
update = require('./update')
capitano.permission 'user', (done) ->
resin.auth.isLoggedIn (isLoggedIn) ->
resin.auth.isLoggedIn (error, isLoggedIn) ->
return done(error) if error?
if not isLoggedIn
return done(new Error('You have to log in'))
return done()