Compare commits
2 commits
24233147ad
...
35235aa29c
Author | SHA1 | Date | |
---|---|---|---|
35235aa29c | |||
ca630e4f11 |
3 changed files with 10 additions and 15 deletions
|
@ -26,23 +26,23 @@ class EditProfileForm(FlaskForm):
|
||||||
submit = SubmitField('Update')
|
submit = SubmitField('Update')
|
||||||
|
|
||||||
class EditProfileAdminForm(FlaskForm):
|
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')
|
confirmed = BooleanField('Activated')
|
||||||
role = SelectField('Role', coerce=int)
|
role = SelectField('Role', coerce=int)
|
||||||
|
|
||||||
name = StringField('Лице за контакт:', [validators.DataRequired(), validators.Length(3, 60)])
|
name = StringField('Contact name:', [validators.DataRequired(), validators.Length(3, 60)])
|
||||||
address = StringField('Адрес:', [validators.DataRequired(), validators.Length(2, 50)])
|
address = StringField('Address:', [validators.DataRequired(), validators.Length(2, 50)])
|
||||||
city = StringField('Град:', [validators.DataRequired(), validators.Length(2,40)])
|
city = StringField('City:', [validators.DataRequired(), validators.Length(2,40)])
|
||||||
postcode = DecimalField('Пощенски Код:')
|
postcode = DecimalField('Postcode:')
|
||||||
|
|
||||||
clist = []
|
clist = []
|
||||||
for c in countries:
|
for c in countries:
|
||||||
clist.append((c.alpha2, c.name))
|
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')
|
twofactor = BooleanField('2-factor authentication')
|
||||||
submit = SubmitField('Обнови')
|
submit = SubmitField('Renew')
|
||||||
|
|
||||||
def __init__(self, user, *args, **kwargs):
|
def __init__(self, user, *args, **kwargs):
|
||||||
super(EditProfileAdminForm, self).__init__(*args, **kwargs)
|
super(EditProfileAdminForm, self).__init__(*args, **kwargs)
|
||||||
|
@ -52,6 +52,6 @@ class EditProfileAdminForm(FlaskForm):
|
||||||
|
|
||||||
def validate_email(self, field):
|
def validate_email(self, field):
|
||||||
if field.data != self.user.email and User.query.filter_by(email=field.data).first():
|
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.')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ def profile():
|
||||||
current_user.twofactor = form.twofactor.data
|
current_user.twofactor = form.twofactor.data
|
||||||
db.session.add(current_user)
|
db.session.add(current_user)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
flash('Info Updated!')
|
flash('Profile info Updated!')
|
||||||
|
|
||||||
form.name.data = current_user.name
|
form.name.data = current_user.name
|
||||||
form.address.data = current_user.address
|
form.address.data = current_user.address
|
||||||
|
|
|
@ -69,7 +69,6 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
|
@ -94,10 +93,6 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue