Skip to content
Snippets Groups Projects
Commit 962b347e authored by Martin Mareš's avatar Martin Mareš
Browse files

Testovací verze přechodu do CMS

parent 324e2b6a
No related branches found
No related tags found
No related merge requests found
{% 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 %}
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,
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment