|
|
|
@ -26,23 +26,23 @@ class EditProfileForm(FlaskForm):
|
|
|
|
|
submit = SubmitField('Update')
|
|
|
|
|
|
|
|
|
|
class EditProfileAdminForm(FlaskForm):
|
|
|
|
|
email = StringField('Електроннa поща (логин):', [validators.DataRequired(), validators.Length(1, 64), validators.Email()])
|
|
|
|
|
email = StringField('Email login address:', [validators.DataRequired(), validators.Length(1, 64), validators.Email()])
|
|
|
|
|
confirmed = BooleanField('Activated')
|
|
|
|
|
role = SelectField('Role', coerce=int)
|
|
|
|
|
|
|
|
|
|
name = StringField('Лице за контакт:', [validators.DataRequired(), validators.Length(3, 60)])
|
|
|
|
|
address = StringField('Адрес:', [validators.DataRequired(), validators.Length(2, 50)])
|
|
|
|
|
city = StringField('Град:', [validators.DataRequired(), validators.Length(2,40)])
|
|
|
|
|
postcode = DecimalField('Пощенски Код:')
|
|
|
|
|
name = StringField('Contact name:', [validators.DataRequired(), validators.Length(3, 60)])
|
|
|
|
|
address = StringField('Address:', [validators.DataRequired(), validators.Length(2, 50)])
|
|
|
|
|
city = StringField('City:', [validators.DataRequired(), validators.Length(2,40)])
|
|
|
|
|
postcode = DecimalField('Postcode:')
|
|
|
|
|
|
|
|
|
|
clist = []
|
|
|
|
|
for c in countries:
|
|
|
|
|
clist.append((c.alpha2, c.name))
|
|
|
|
|
country = SelectField('Държава:', choices=clist)
|
|
|
|
|
country = SelectField('Country:', choices=clist)
|
|
|
|
|
|
|
|
|
|
phone = DecimalField('Телефон:', [validators.DataRequired()])
|
|
|
|
|
phone = DecimalField('Phone:', [validators.DataRequired()])
|
|
|
|
|
twofactor = BooleanField('2-factor authentication')
|
|
|
|
|
submit = SubmitField('Обнови')
|
|
|
|
|
submit = SubmitField('Renew')
|
|
|
|
|
|
|
|
|
|
def __init__(self, user, *args, **kwargs):
|
|
|
|
|
super(EditProfileAdminForm, self).__init__(*args, **kwargs)
|
|
|
|
@ -52,6 +52,6 @@ class EditProfileAdminForm(FlaskForm):
|
|
|
|
|
|
|
|
|
|
def validate_email(self, field):
|
|
|
|
|
if field.data != self.user.email and User.query.filter_by(email=field.data).first():
|
|
|
|
|
raise ValidationError('Email-а е вече регистриран.')
|
|
|
|
|
raise ValidationError('The mail address is already registered.')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|