Make use of authHooks in actions

This commit is contained in:
Juan Cruz Viotti 2014-11-18 12:37:01 -04:00
parent 8bdd3b697a
commit 8777bb9536
2 changed files with 4 additions and 2 deletions

View File

@ -1,7 +1,8 @@
server = require('../server/server') server = require('../server/server')
applicationModel = require('../models/application') applicationModel = require('../models/application')
authHooks = require('../hooks/auth')
exports.list = -> exports.list = authHooks.failIfNotLoggedIn ->
applicationModel.getAll().then (applications) -> applicationModel.getAll().then (applications) ->
for app in applications for app in applications

View File

@ -1,6 +1,7 @@
open = require('open') open = require('open')
async = require('async') async = require('async')
auth = require('../auth/auth') auth = require('../auth/auth')
authHooks = require('../hooks/auth')
widgets = require('../widgets/widgets') widgets = require('../widgets/widgets')
config = require('../config') config = require('../config')
@ -19,7 +20,7 @@ exports.login = (credentials) ->
], (error) -> ], (error) ->
throw error if error? throw error if error?
exports.logout = -> exports.logout = authHooks.failIfNotLoggedIn ->
auth.logout() auth.logout()
exports.signup = -> exports.signup = ->