Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
add author
Browse files Browse the repository at this point in the history
  • Loading branch information
FeeiCN committed Sep 10, 2016
1 parent 453357b commit d6bb714
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
3 changes: 2 additions & 1 deletion app/controller/backend/RulesController.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def rules(page):
def add_new_rule():
if request.method == 'POST':
vc = ValidateClass(request, 'vul_type', 'language', 'regex_location', 'regex_repair', 'repair_block',
'description', 'repair', 'level')
'description', 'repair', 'author', 'level')
ret, msg = vc.check_args()
if not ret:
return jsonify(tag="danger", msg=msg)
Expand All @@ -94,6 +94,7 @@ def add_new_rule():
block_repair=vc.vars.repair_block,
description=vc.vars.description,
repair=vc.vars.repair,
author=vc.vars.author,
status=1,
level=vc.vars.level,
created_at=current_time,
Expand Down
6 changes: 6 additions & 0 deletions app/templates/asset/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ $("#show_all_rules").click(function () {
var repair_block = $("#repair-block:checked").val();
var description = $("#description").val();
var repair = $("#repair").val();
var author = $("input[name=author]").val();
var level = $("#level:checked").val();

// check data
Expand Down Expand Up @@ -605,6 +606,10 @@ $("#show_all_rules").click(function () {
showAlert('danger', 'repair can not be blank.', '#add-new-rule-result');
return false;
}
if (!author || author == "") {
showAlert('danger', 'author can not be blank.', '#add-new-rule-result');
return false;
}
if (!level || level == "") {
showAlert('danger', 'level can not be blank.', "#add-new-rule-result");
return false;
Expand All @@ -619,6 +624,7 @@ $("#show_all_rules").click(function () {
'repair_block': repair_block,
'description': description,
'repair': repair,
'author': author,
'level': level
};
$.post('add_new_rule', data, function (res) {
Expand Down
24 changes: 18 additions & 6 deletions app/templates/backend/rule/add_new_rule.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<form role="form">
<div style="margin-top: 20px;">
<div class="form-group col-md-3" style="padding-left: 0;">
<div class="form-group col-md-2">
<label for="vul_type">Author</label>
<input type="text" name="author" class="form-control" value="" placeholder="多个以,分隔">
</div>
<div class="form-group col-md-4" style="padding-left: 0;">
<label for="vul_id">Vul type</label>
<select id="vul_type" class="form-control">
{% for vul in data.vul_type %}
Expand All @@ -10,7 +13,7 @@
{% endfor %}
</select>
</div>
<div class="form-group col-md-3" style="padding-right: 0;">
<div class="form-group col-md-6" style="padding-right: 0;">
<label for="add-rule-language">Language</label>
<select id="add-rule-language" class="form-control">
{% for lang in data.languages %}
Expand All @@ -20,7 +23,17 @@
{% endfor %}
</select>
</div>
<div class="form-group col-md-3" style="padding-left: 50px">

<div class="form-group col-md-4">
<label for="status">Status</label>
<label class="radio" style="padding-left: 25px;">
<input type="radio" name="status" id="status" value="1"> On
</label>
<label class="radio" style="padding-left: 25px;">
<input type="radio" name="status" id="status" value="0"> Off
</label>
</div>
<div class="form-group col-md-4" style="padding-left: 50px">
<label>Repair Block</label>
<label class="radio" style="padding-left: 25px;">
<input type="radio" name="repair-block" id="repair-block" value="0">
Expand All @@ -31,7 +44,7 @@
<span class="glyphicon glyphicon-arrow-down" aria-hidden="true"></span> Function Down
</label>
</div>
<div class="form-group col-md-3">
<div class="form-group col-md-4">
<label>Level</label>
<label class="radio" style="padding-left: 20px;">
<input type="radio" name="level" id="level" value="1"> Low
Expand All @@ -43,7 +56,6 @@
<input type="radio" name="level" id="level" value="3" checked> High
</label>
</div>
</div>
<div class="form-group">
<label for="regex-location">Regex Location</label>
<textarea class="form-control" id="regex-location" placeholder="Please input location regex."></textarea>
Expand Down

0 comments on commit d6bb714

Please sign in to comment.