hotfix 发帖版块选择

This commit is contained in:
alsotang 2014-09-18 23:52:05 +08:00
parent 0f74e584bb
commit b3ca077e5a
2 changed files with 6 additions and 2 deletions

View File

@ -102,6 +102,10 @@ exports.create = function (req, res, next) {
});
};
var allTags = config.tabs.map(function (tPair) {
return tPair[0];
});
exports.put = function (req, res, next) {
var title = sanitize(req.body.title).trim();
title = sanitize(title).xss();
@ -114,7 +118,7 @@ exports.put = function (req, res, next) {
editError = '标题不能是空的。';
} else if (title.length < 5 && title.length > 100) {
editError = '标题字数太多或太少。';
} else if (!tab) {
} else if (!tab || allTags.indexOf(tab) === -1) {
editError = '必须选择一个版块。';
}
// END 验证

View File

@ -32,7 +32,7 @@
<fieldset>
<span class="tab-selector">选择版块:</span>
<select name="tab" id="tab-value">
<option>请选择</option>
<option value="">请选择</option>
<%
var tabValue = '';
if (typeof(tab) !== 'undefined') {