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
Martin Mareš
Odevzdávací Systém MO
Commits
962b347e
Commit
962b347e
authored
3 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Testovací verze přechodu do CMS
parent
324e2b6a
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mo/web/templates/cms.html
+14
-0
14 additions, 0 deletions
mo/web/templates/cms.html
mo/web/user.py
+22
-0
22 additions, 0 deletions
mo/web/user.py
with
36 additions
and
0 deletions
mo/web/templates/cms.html
0 → 100644
+
14
−
0
View file @
962b347e
{% extends "base.html" %}
{% block title %}Vítejte{% endblock %}
{% block body %}
<form
action=
'http://localhost:8888/sso-login'
method=
POST
>
<input
type=
hidden
name=
username
value=
"{{ username }}"
>
<input
type=
hidden
name=
first_name
value=
"{{ first_name }}"
>
<input
type=
hidden
name=
last_name
value=
"{{ last_name }}"
>
<input
type=
hidden
name=
timestamp
value=
"{{ timestamp }}"
>
<input
type=
hidden
name=
signature
value=
"{{ signature }}"
>
<input
type=
submit
value=
"CMS"
>
</form>
{% endblock %}
This diff is collapsed.
Click to expand it.
mo/web/user.py
+
22
−
0
View file @
962b347e
from
flask
import
render_template
,
jsonify
,
g
,
redirect
,
url_for
,
flash
,
request
from
flask_wtf
import
FlaskForm
import
flask_wtf.file
import
hashlib
import
hmac
from
sqlalchemy
import
and_
from
sqlalchemy.orm
import
joinedload
from
typing
import
List
,
Tuple
...
...
@@ -444,3 +446,23 @@ def user_paper(contest_id: int, paper_id: int):
raise
werkzeug
.
exceptions
.
Forbidden
()
return
mo
.
web
.
util
.
send_task_paper
(
paper
)
@app.route
(
'
/user/cms
'
)
def
user_cms
():
username
=
"
brum
"
first_name
=
"
Lední
"
last_name
=
"
Medvěd
"
timestamp
=
str
(
int
(
mo
.
now
.
timestamp
()))
msg
=
"
:
"
.
join
((
username
,
first_name
,
last_name
,
timestamp
)).
encode
(
'
utf-8
'
)
key
=
"
BrumBrum
"
.
encode
(
'
us-ascii
'
)
signature
=
hmac
.
HMAC
(
key
,
msg
,
digestmod
=
hashlib
.
sha256
).
hexdigest
()
return
render_template
(
'
cms.html
'
,
username
=
username
,
first_name
=
first_name
,
last_name
=
last_name
,
timestamp
=
timestamp
,
signature
=
signature
,
)
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