-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforms.py
More file actions
36 lines (24 loc) · 1.8 KB
/
Copy pathforms.py
File metadata and controls
36 lines (24 loc) · 1.8 KB
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
33
34
__author__ = 'marcusfaust'
import re
from wtforms import Form, TextField, PasswordField, IntegerField, ValidationError
from wtforms.validators import Required, Email, EqualTo, NumberRange, Regexp
def valid_ip(form, field):
if not re.match(r'^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$', field.data):
raise ValidationError('Invalid IP Address')
class NewUserForm(Form):
boxuseremail = TextField('Box Account Email', [Required(), Email(message='Invalid Email Address')])
mitrend_user = TextField('MiTrend User Email', [Required(), Email(message='Invalid Email Address')])
password = PasswordField('MiTrend Password', [Required(), EqualTo('confirm', message='Passwords must match')])
confirm = PasswordField('Repeat Password', [Required()])
class assignRU(Form):
pass
class NodeIdentities(Form):
starting_ip = TextField('First IP Address', [Required(), Regexp(r'^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$', message='Invalid IP Address')])
hostname_prefix = TextField('Hostname Range Prefix', [Required()])
first_hostname_id = TextField('First Hostname Identifier', [Required(), Regexp(r'^[0-9]*$', message='Invalid Integer')])
count = IntegerField('Item Count', [Required(), NumberRange(min=1, max=60, message='Outside of Range')])
class ESXiGlobalParams(Form):
subnetmask = TextField('Mgmt Subnet Mask', [Required(), Regexp(r'^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$', message='Invalid IP Address')])
default_gw = TextField('Mgmt Default GW', [Required(), Regexp(r'^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$', message='Invalid IP Address')])
dns = TextField('First DNS Server', [Required(), Regexp(r'^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$', message='Invalid IP Address')])
domain_suffix = TextField('Domain Name', [Required()])