fix admin

This commit is contained in:
jysperm
2014-07-19 00:22:33 +08:00
parent 9895aa3e17
commit 1249ad581c
4 changed files with 8 additions and 12 deletions

View File

@@ -11,10 +11,7 @@ Request:
"order_id": "560097131641814"
}
Response:
{}
Exception:
* account_not_exist
* invalid_amount

View File

@@ -3,12 +3,6 @@ module.exports =
url: 'http://rp3.rpvhost.net'
port: 3000
debug:
mock_test: false
admin:
username: ['jysperm']
account:
invalid_username: [
'root', 'daemon', 'bin', 'sys', 'sync', 'games', 'man', 'lp', 'mail', 'colord', 'nobody',

View File

@@ -5,7 +5,7 @@ mAccount = require '../model/account'
module.exports = exports = express.Router()
exports.get '/', requestAdminAuthenticate, renderAccount, (req, res) ->
mAccount.find({}).toArray (err, accounts) ->
mAccount.find().toArray (err, accounts) ->
res.render 'admin/index',
accounts: accounts
@@ -15,7 +15,9 @@ exports.post '/create_payment', requestAdminAuthenticate, (req, res) ->
return res.error 'account_not_exist'
amount = parseFloat req.body.amount
amount = 0 unless _.isNaN amount
if _.isNaN amount
return res.error 'invalid_amount'
mAccount.incBalance account, 'deposit', amount,
type: req.body.type

View File

@@ -32,6 +32,9 @@ html
a= account.username
li
a(href='/panel/')= t('panel.')
if mAccount.inGroup(account, 'root')
li
a(href='/admin/') 管理员面板
li
a#logout(href='/account/logout/')= t('account.logout')
else