This commit is contained in:
jysperm
2014-05-30 15:16:46 +08:00
parent 674076e7ea
commit 881f58cee0
2 changed files with 6 additions and 8 deletions

View File

@@ -23,7 +23,7 @@ exports.post '/switch', (req, res) ->
mAccount.update _id: req.account._id,
$set:
'attribute.plugin.phpfpm.is_enable': false
'attribute.plugin.phpfpm.is_enable': req.body.enable
, ->
plugin.systemOperate (callback) ->
service.switch req.account, req.body.enable, callback

View File

@@ -3,19 +3,17 @@ express = require 'express'
plugin = require '../../core/plugin'
{requestAuthenticate} = require '../../core/router/middleware'
mAccount = require '../../core/model/account'
module.exports = exports = express.Router()
exports.use (req, res, next) ->
mAccount.authenticate req.token, (account) ->
unless account
return res.json 400, error: 'auth_failed'
req.inject [requestAuthenticate], ->
unless 'ssh' in req.account.attribute.services
return res.error 'not_in_service'
unless 'ssh' in account.attribute.service
return res.json 400, error: 'not_in_service'
req.account = account
next()
exports.post '/update_passwd/', (req, res) ->