1

Keyword validation

This commit is contained in:
Alex Yatskov 2014-10-03 15:28:35 +09:00
parent b587ee084c
commit 085e351245

View File

@ -175,10 +175,16 @@ function loadDb(params) {
}
function addKeyword(query, callback) {
var keyword = (query.keyword || '').toLowerCase();
if (!/^[a-zA-Z0-9]+$/.test(keyword)) {
callback({
keyword: keyword,
success: false
});
}
else {
getKeywords(function(keywords) {
var keyword = query.keyword.toLowerCase();
var features = combine(keywords, query.params);
var values = [
keyword,
features.food || 0.0,
@ -194,6 +200,7 @@ function addKeyword(query, callback) {
});
});
});
}
}
function removeKeyword(query, callback) {