mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-25 23:55:24 +00:00
instances/views.py check instance name, alloweed r^[a-zA-Z0-9-]+$
This commit is contained in:
parent
08cc19900c
commit
525d42a74d
1 changed files with 4 additions and 0 deletions
|
@ -3,6 +3,7 @@ import time
|
||||||
import json
|
import json
|
||||||
import socket
|
import socket
|
||||||
import crypt
|
import crypt
|
||||||
|
import re
|
||||||
from string import letters, digits
|
from string import letters, digits
|
||||||
from random import choice
|
from random import choice
|
||||||
from bisect import insort
|
from bisect import insort
|
||||||
|
@ -610,6 +611,9 @@ def instance(request, compute_id, vname):
|
||||||
elif check_instance:
|
elif check_instance:
|
||||||
msg = _("Instance '%s' already exists!" % clone_data['name'])
|
msg = _("Instance '%s' already exists!" % clone_data['name'])
|
||||||
error_messages.append(msg)
|
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:
|
else:
|
||||||
for post in request.POST:
|
for post in request.POST:
|
||||||
clone_data[post] = request.POST.get(post, '')
|
clone_data[post] = request.POST.get(post, '')
|
||||||
|
|
Loading…
Reference in a new issue