1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 23:25:24 +00:00

instances/views.py check instance name, alloweed r^[a-zA-Z0-9-]+$

This commit is contained in:
Ing. Jan KRCMAR 2016-09-06 13:01:45 +02:00
parent 08cc19900c
commit 525d42a74d

View file

@ -3,6 +3,7 @@ import time
import json
import socket
import crypt
import re
from string import letters, digits
from random import choice
from bisect import insort
@ -610,6 +611,9 @@ def instance(request, compute_id, vname):
elif check_instance:
msg = _("Instance '%s' already exists!" % clone_data['name'])
error_messages.append(msg)
elif not re.match(r'^[a-zA-Z0-9-]+$', clone_data['name']):
msg = _("Instance name '%s' contains invalid characters!" % clone_data['name'])
error_messages.append(msg)
else:
for post in request.POST:
clone_data[post] = request.POST.get(post, '')