Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Looking for advice? Join the
Matrix channel for GitLab users in Bielefeld
!
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
61545ed4
Commit
61545ed4
authored
5 years ago
by
Stephan Porada
Browse files
Options
Downloads
Patches
Plain Diff
Push one fix idea for multiple forms
parent
755f5f31
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/profile/forms.py
+2
-2
2 additions, 2 deletions
app/profile/forms.py
app/profile/views.py
+17
-7
17 additions, 7 deletions
app/profile/views.py
with
19 additions
and
9 deletions
app/profile/forms.py
+
2
−
2
View file @
61545ed4
from
flask_wtf
import
FlaskForm
from
flask_wtf
import
FlaskForm
from
wtforms
import
(
PasswordField
,
StringField
,
SubmitField
,
from
wtforms
import
(
PasswordField
,
StringField
,
SubmitField
,
ValidationError
,
BooleanField
)
ValidationError
,
BooleanField
)
from
wtforms.validators
import
DataRequired
,
EqualTo
,
Length
,
Email
from
wtforms.validators
import
DataRequired
,
EqualTo
,
Email
from
..models
import
User
from
..models
import
User
import
logging
class
ChangePasswordForm
(
FlaskForm
):
class
ChangePasswordForm
(
FlaskForm
):
"""
"""
...
...
This diff is collapsed.
Click to expand it.
app/profile/views.py
+
17
−
7
View file @
61545ed4
...
@@ -45,14 +45,24 @@ def profile_change_password():
...
@@ -45,14 +45,24 @@ def profile_change_password():
@login_required
@login_required
def
profile_edit_user_info
():
def
profile_edit_user_info
():
edit_user_info_form
=
EditProfileForm
(
user
=
current_user
)
edit_user_info_form
=
EditProfileForm
(
user
=
current_user
)
if
not
edit_user_info_form
.
validate_on_submit
():
if
edit_user_info_form
.
validate_on_submit
():
abort
(
400
)
current_user
.
email
=
edit_user_info_form
.
email
.
data
current_user
.
email
=
edit_user_info_form
.
email
.
data
db
.
session
.
add
(
current_user
.
_get_current_object
())
db
.
session
.
add
(
current_user
.
_get_current_object
())
db
.
session
.
commit
()
db
.
session
.
commit
()
flash
(
'
Your email has been updated.
'
)
flash
(
'
Your email has been updated.
'
)
else
:
logger
.
warning
(
'
Form: {}
'
.
format
(
edit_user_info_form
.
errors
))
return
render_template
(
'
profile/index.html.j2
'
,
change_password_form
=
ChangePasswordForm
(),
edit_user_info_form
=
edit_user_info_form
,
edit_user_settings_form
=
EditUserSettingsForm
(),
title
=
'
Profile
'
)
edit_user_info_form
.
email
.
data
=
current_user
.
email
edit_user_info_form
.
email
.
data
=
current_user
.
email
return
redirect
(
url_for
(
'
profile.index
'
))
return
render_template
(
'
profile/index.html.j2
'
,
change_password_form
=
ChangePasswordForm
(),
edit_user_info_form
=
EditProfileForm
(
user
=
current_user
),
edit_user_settings_form
=
EditUserSettingsForm
(),
title
=
'
Profile
'
)
@profile.route
(
'
/edit_user_settings
'
,
methods
=
[
'
POST
'
])
@profile.route
(
'
/edit_user_settings
'
,
methods
=
[
'
POST
'
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment