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
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
30f405bb
Commit
30f405bb
authored
5 years ago
by
Stephan Porada
Browse files
Options
Downloads
Patches
Plain Diff
Add some docstrings
parent
4918d185
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/auth/forms.py
+4
-0
4 additions, 0 deletions
app/auth/forms.py
app/auth/views.py
+7
-0
7 additions, 0 deletions
app/auth/views.py
app/main/views.py
+3
-0
3 additions, 0 deletions
app/main/views.py
with
14 additions
and
0 deletions
app/auth/forms.py
+
4
−
0
View file @
30f405bb
...
@@ -48,6 +48,10 @@ class PasswordResetRequestForm(FlaskForm):
...
@@ -48,6 +48,10 @@ class PasswordResetRequestForm(FlaskForm):
class
ChangeAccountForm
(
FlaskForm
):
class
ChangeAccountForm
(
FlaskForm
):
"""
Form to change information of currently logged in User. User can change
informations about him on his own.
"""
email
=
StringField
(
'
Email
'
,
validators
=
[
Optional
(),
Length
(
1
,
64
),
email
=
StringField
(
'
Email
'
,
validators
=
[
Optional
(),
Length
(
1
,
64
),
Email
()])
Email
()])
username
=
StringField
(
'
Username
'
,
validators
=
[
username
=
StringField
(
'
Username
'
,
validators
=
[
...
...
This diff is collapsed.
Click to expand it.
app/auth/views.py
+
7
−
0
View file @
30f405bb
...
@@ -66,6 +66,10 @@ def confirm(token):
...
@@ -66,6 +66,10 @@ def confirm(token):
@auth.before_app_request
@auth.before_app_request
def
before_request
():
def
before_request
():
"""
Checks if a user is unconfirmed when visiting specific sites. Redirects to
unconfirmed view if user is unconfirmed.
"""
if
current_user
.
is_authenticated
\
if
current_user
.
is_authenticated
\
and
not
current_user
.
confirmed
\
and
not
current_user
.
confirmed
\
and
request
.
blueprint
!=
'
auth
'
\
and
request
.
blueprint
!=
'
auth
'
\
...
@@ -128,6 +132,9 @@ def password_reset(token):
...
@@ -128,6 +132,9 @@ def password_reset(token):
@auth.route
(
'
/settings
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
@auth.route
(
'
/settings
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
@login_required
@login_required
def
settings
():
def
settings
():
"""
View where loged in User can change own User information like Password etc.
"""
form
=
ChangeAccountForm
()
form
=
ChangeAccountForm
()
if
form
.
validate_on_submit
():
if
form
.
validate_on_submit
():
flash
(
'
It is just a test, nothing changed.
'
)
flash
(
'
It is just a test, nothing changed.
'
)
...
...
This diff is collapsed.
Click to expand it.
app/main/views.py
+
3
−
0
View file @
30f405bb
...
@@ -15,6 +15,9 @@ def index():
...
@@ -15,6 +15,9 @@ def index():
@login_required
@login_required
@admin_required
@admin_required
def
for_admins_only
():
def
for_admins_only
():
"""
View for admin page only accesible by admins.
"""
users
=
User
.
query
.
order_by
(
User
.
username
).
all
()
users
=
User
.
query
.
order_by
(
User
.
username
).
all
()
items
=
[
AdminUserItem
(
u
.
username
,
u
.
email
,
u
.
role_id
,
u
.
confirmed
)
for
u
in
users
]
items
=
[
AdminUserItem
(
u
.
username
,
u
.
email
,
u
.
role_id
,
u
.
confirmed
)
for
u
in
users
]
table
=
AdminUserTable
(
items
)
table
=
AdminUserTable
(
items
)
...
...
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