Compare commits
No commits in common. "35235aa29c8b67f1ed4cdb3b31901009201527c9" and "24233147ad610f8335afdb89c13a1cdc5b32e210" have entirely different histories.
35235aa29c
...
24233147ad
|
@ -26,23 +26,23 @@ class EditProfileForm(FlaskForm):
|
||||||
submit = SubmitField('Update')
|
submit = SubmitField('Update')
|
||||||
|
|
||||||
class EditProfileAdminForm(FlaskForm):
|
class EditProfileAdminForm(FlaskForm):
|
||||||
email = StringField('Email login address:', [validators.DataRequired(), validators.Length(1, 64), validators.Email()])
|
email = StringField('Електроннa поща (логин):', [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('Contact name:', [validators.DataRequired(), validators.Length(3, 60)])
|
name = StringField('Лице за контакт:', [validators.DataRequired(), validators.Length(3, 60)])
|
||||||
address = StringField('Address:', [validators.DataRequired(), validators.Length(2, 50)])
|
address = StringField('Адрес:', [validators.DataRequired(), validators.Length(2, 50)])
|
||||||
city = StringField('City:', [validators.DataRequired(), validators.Length(2,40)])
|
city = StringField('Град:', [validators.DataRequired(), validators.Length(2,40)])
|
||||||
postcode = DecimalField('Postcode:')
|
postcode = DecimalField('Пощенски Код:')
|
||||||
|
|
||||||
clist = []
|
clist = []
|
||||||
for c in countries:
|
for c in countries:
|
||||||
clist.append((c.alpha2, c.name))
|
clist.append((c.alpha2, c.name))
|
||||||
country = SelectField('Country:', choices=clist)
|
country = SelectField('Държава:', choices=clist)
|
||||||
|
|
||||||
phone = DecimalField('Phone:', [validators.DataRequired()])
|
phone = DecimalField('Телефон:', [validators.DataRequired()])
|
||||||
twofactor = BooleanField('2-factor authentication')
|
twofactor = BooleanField('2-factor authentication')
|
||||||
submit = SubmitField('Renew')
|
submit = SubmitField('Обнови')
|
||||||
|
|
||||||
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('The mail address is already registered.')
|
raise ValidationError('Email-а е вече регистриран.')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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('Profile info Updated!')
|
flash('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,6 +69,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
|
@ -93,6 +94,10 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue