passwd -> password

This commit is contained in:
jysperm
2014-07-13 22:20:44 +08:00
parent 4e20734557
commit 72e7ea8a77
17 changed files with 71 additions and 71 deletions

View File

@@ -1,16 +1,16 @@
## SSH Plugin API
### POST /plugin/ssh/update_passwd/
### POST /plugin/ssh/update_password/
Request:
{
"passwd": "123123"
"password": "123123"
}
No Response.
Exception:
* invalid_passwd
* invalid_password
* not_in_service

View File

@@ -15,12 +15,12 @@ exports.use (req, res, next) ->
next()
exports.post '/update_passwd/', (req, res) ->
unless req.body.passwd or not /^[A-Za-z0-9\-_]+$/.test req.body.passwd
return res.error 'invalid_passwd'
exports.post '/update_password/', (req, res) ->
unless req.body.password or not /^[A-Za-z0-9\-_]+$/.test req.body.password
return res.error 'invalid_password'
plugin.systemOperate (callback) ->
child_process.exec "echo '#{req.account.username}:#{req.body.passwd}' | sudo chpasswd", (err, stdout, stderr) ->
child_process.exec "echo '#{req.account.username}:#{req.body.password}' | sudo chpassword", (err, stdout, stderr) ->
throw err if err
callback()
, ->