mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-22 15:20:09 +01:00
Bug fixed
This commit is contained in:
parent
88ed9c3e79
commit
b7a047a743
@ -107,7 +107,7 @@ def read_conf_file(config_name):
|
|||||||
conf_peers = file[peers_start:]
|
conf_peers = file[peers_start:]
|
||||||
peer = -1
|
peer = -1
|
||||||
for i in conf_peers:
|
for i in conf_peers:
|
||||||
if not is_match("^#(.*)", i):
|
if not is_match("#(.*)", i):
|
||||||
if i == "[Peer]":
|
if i == "[Peer]":
|
||||||
peer += 1
|
peer += 1
|
||||||
conf_peer_data["Peers"].append({})
|
conf_peer_data["Peers"].append({})
|
||||||
@ -388,7 +388,8 @@ def cleanIpWithRange(ip):
|
|||||||
|
|
||||||
|
|
||||||
def checkIpWithRange(ip):
|
def checkIpWithRange(ip):
|
||||||
return is_match("((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|\/)){4}(0|8|16|24|32)(,|$)", ip)
|
return is_match("((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|\/)){4}(0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|"+
|
||||||
|
"18|19|20|21|22|23|24|25|26|27|28|29|30|31|32)(,|$)", ip)
|
||||||
|
|
||||||
|
|
||||||
def checkAllowedIPs(ip):
|
def checkAllowedIPs(ip):
|
||||||
@ -769,7 +770,6 @@ def add_peer(config_name):
|
|||||||
return "Allowed IP already taken by another peer."
|
return "Allowed IP already taken by another peer."
|
||||||
if not checkIp(DNS):
|
if not checkIp(DNS):
|
||||||
return "DNS formate is incorrect. Example: 1.1.1.1"
|
return "DNS formate is incorrect. Example: 1.1.1.1"
|
||||||
|
|
||||||
if not checkAllowedIPs(endpoint_allowed_ip):
|
if not checkAllowedIPs(endpoint_allowed_ip):
|
||||||
return "Endpoint Allowed IPs format is incorrect."
|
return "Endpoint Allowed IPs format is incorrect."
|
||||||
else:
|
else:
|
||||||
@ -829,6 +829,9 @@ def save_peer_setting(config_name):
|
|||||||
peers = Query()
|
peers = Query()
|
||||||
if len(db.search(peers.id == id)) == 1:
|
if len(db.search(peers.id == id)) == 1:
|
||||||
check_ip = checkAllowedIP(id, allowed_ip, config_name)
|
check_ip = checkAllowedIP(id, allowed_ip, config_name)
|
||||||
|
if not checkIpWithRange(endpoint_allowed_ip):
|
||||||
|
return jsonify({"status": "failed", "msg": "Endpoint Allowed IPs format is incorrect."})
|
||||||
|
|
||||||
if private_key != "":
|
if private_key != "":
|
||||||
check_key = checkKeyMatch(private_key, id, config_name)
|
check_key = checkKeyMatch(private_key, id, config_name)
|
||||||
if check_key['status'] == "failed":
|
if check_key['status'] == "failed":
|
||||||
|
@ -96,6 +96,8 @@ $("#save_peer").click(function(){
|
|||||||
}else{
|
}else{
|
||||||
$("#add_peer_alert").html("Please fill in all required box.");
|
$("#add_peer_alert").html("Please fill in all required box.");
|
||||||
$("#add_peer_alert").removeClass("d-none");
|
$("#add_peer_alert").removeClass("d-none");
|
||||||
|
$(this).removeAttr("disabled")
|
||||||
|
$(this).html("Save")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
var qrcodeModal = new bootstrap.Modal(document.getElementById('qrcode_modal'), {
|
var qrcodeModal = new bootstrap.Modal(document.getElementById('qrcode_modal'), {
|
||||||
@ -249,6 +251,8 @@ $("#save_peer_setting").click(function (){
|
|||||||
}else{
|
}else{
|
||||||
$("#setting_peer_alert").html("Please fill in all required box.");
|
$("#setting_peer_alert").html("Please fill in all required box.");
|
||||||
$("#setting_peer_alert").removeClass("d-none");
|
$("#setting_peer_alert").removeClass("d-none");
|
||||||
|
$("#save_peer_setting").removeAttr("disabled")
|
||||||
|
$("#save_peer_setting").html("Save")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user