mirror of
https://github.com/HackPlan/RootPanel.git
synced 2026-06-19 04:35:04 +08:00
fixbugs
This commit is contained in:
@@ -23,6 +23,7 @@ block content
|
||||
.col-md-9
|
||||
#page-alert.alert.alert-danger
|
||||
#page-success.alert.alert-success
|
||||
|
||||
.row
|
||||
header= t('panel.overview')
|
||||
p
|
||||
@@ -48,4 +49,4 @@ block content
|
||||
.row
|
||||
!= widget.html
|
||||
append footer
|
||||
script(src='/script/panel/panel.js')
|
||||
script(src='/script/panel/panel.js')
|
||||
|
||||
@@ -5,7 +5,7 @@ mAccount = require '../../core/model/account'
|
||||
|
||||
module.exports = exports = express.Router()
|
||||
|
||||
exports.use (req, res) ->
|
||||
exports.use (req, res, next) ->
|
||||
mAccount.authenticate req.token, (account) ->
|
||||
unless account
|
||||
return res.json 400, error: 'auth_failed'
|
||||
@@ -14,11 +14,12 @@ exports.use (req, res) ->
|
||||
return res.json 400, error: 'not_in_service'
|
||||
|
||||
req.account = account
|
||||
next()
|
||||
|
||||
exports.post '/update_passwd/', (req, res) ->
|
||||
unless req.body.passwd or not /^[A-Za-z0-9\-_]+$/.test req.body.passwd
|
||||
return res.json 400, error: 'invalid_passwd'
|
||||
|
||||
child_process.exec "echo '#{req.account.username}:{#{req.body.passwd}}' | sudo chpasswd", (err, stdout, stderr) ->
|
||||
child_process.exec "echo '#{req.account.username}:#{req.body.passwd}' | sudo chpasswd", (err, stdout, stderr) ->
|
||||
throw err if err
|
||||
res.json {}
|
||||
|
||||
Reference in New Issue
Block a user