mirror of
https://github.com/HackPlan/RootPanel.git
synced 2026-04-24 03:35:59 +08:00
passwd -> password
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
, ->
|
||||
|
||||
Reference in New Issue
Block a user