Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MO-P
Odevzdávací Systém MO
Commits
9e01c41b
Project 'mj/mo-submit' was moved to 'mo-p/osmo'. Please update any links and bookmarks that may still have the old path.
Commit
9e01c41b
authored
Jan 9, 2022
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
V podstromu /acct/ se musíme vyrovnat s nepřihlášeným uživatelem
parent
b73e6a93
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/web/acct.py
+8
-0
8 additions, 0 deletions
mo/web/acct.py
with
8 additions
and
0 deletions
mo/web/acct.py
+
8
−
0
View file @
9e01c41b
...
...
@@ -23,6 +23,8 @@ import mo.util
from
mo.web
import
app
,
NeedLoginError
import
mo.web.fields
as
mo_fields
# POZOR: V podstromu /acct/ není vyžadován login
class
LoginForm
(
FlaskForm
):
next
=
wtforms
.
HiddenField
()
...
...
@@ -99,6 +101,8 @@ def logout():
@app.route
(
'
/acct/incarnate/<int:id>
'
,
methods
=
(
'
POST
'
,))
def
incarnate
(
id
):
if
not
g
.
user
:
raise
NeedLoginError
()
if
not
g
.
user
.
is_admin
:
raise
werkzeug
.
exceptions
.
Forbidden
()
...
...
@@ -120,6 +124,8 @@ class AcctSettingsForm(FlaskForm):
def
user_settings
():
sess
=
db
.
get_session
()
user
=
g
.
user
if
not
user
:
raise
NeedLoginError
()
form
=
AcctSettingsForm
()
if
not
form
.
submit
.
data
:
...
...
@@ -167,6 +173,8 @@ class PersonalSettingsForm(FlaskForm):
def
user_settings_personal
():
sess
=
db
.
get_session
()
user
=
g
.
user
if
not
user
:
raise
NeedLoginError
()
form
=
PersonalSettingsForm
()
if
not
form
.
submit
.
data
:
...
...
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
sign in
to comment