2017-03-08 13:53:09 -05:00
|
|
|
from flask_wtf import FlaskForm
|
|
|
|
from wtforms import StringField, PasswordField, BooleanField, SubmitField, SelectField, DecimalField
|
|
|
|
from wtforms import validators, ValidationError
|
|
|
|
from wtforms.fields.html5 import EmailField
|
|
|
|
|
2017-08-01 07:21:22 -04:00
|
|
|
from .. import db
|
2017-03-08 13:53:09 -05:00
|
|
|
|
2017-08-01 07:21:22 -04:00
|
|
|
|
|
|
|
class CreateForm(FlaskForm):
|
|
|
|
region_choices = [(1, 'Plovdiv, Bulgaria')]
|
|
|
|
servername = StringField('Domain Name:', [validators.Regexp(message='ex.: myservice1.com, myservice2.local', regex='^[a-zA-Z0-9][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9]{0,1}\.([a-zA-Z]{1,6}|[a-zA-Z0-9-]{1,30}\.[a-zA-Z]{2,3})$'), validators.Length(6,64)])
|
|
|
|
region = SelectField('Region:', choices=region_choices, coerce=int)
|
|
|
|
invite_key = StringField('Invite Code:', [validators.DataRequired(), validators.Length(6,35)])
|
2017-03-08 13:53:09 -05:00
|
|
|
def validate_invite_key(self, field):
|
2017-10-15 07:38:38 -04:00
|
|
|
if field.data != 'invitation1919':
|
2017-03-08 13:53:09 -05:00
|
|
|
raise ValidationError('Denied')
|
2017-08-01 07:21:22 -04:00
|
|
|
submit = SubmitField('Create')
|
2017-03-08 13:53:09 -05:00
|
|
|
|
2017-07-13 19:46:51 -04:00
|
|
|
class ActivateForm(FlaskForm):
|
2017-09-14 20:28:26 -04:00
|
|
|
period = SelectField('Deploy Period', choices=[(1, '1 Month'), (2, '2 Months'), (3, '3 Months'), (6, '6 Months'), (12, '1 Year'), (24, '2 Years')], coerce=int)
|
2017-07-13 19:46:51 -04:00
|
|
|
submit = SubmitField('Activate')
|
2017-08-01 07:21:22 -04:00
|
|
|
|