Skip to content

Commit

Permalink
hodne veci se zmenilo
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Vybíhal committed Nov 10, 2022
1 parent ead11a3 commit bfa6f38
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 7 deletions.
23 changes: 21 additions & 2 deletions static/styles.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
{% endif %}
</p>
{% for category, message in get_flashed_messages(with_categories = true) %}
<p class="flash" {{category}}>{{message}}</p>
<p class="flash {{category}}">
<button class ="hide">X</button>
{{message}}</p>
{% endfor %}


Expand Down Expand Up @@ -78,6 +80,20 @@ <h1>Flask</h1>



<script>
function hide(){
this.parentElement.style.display = "none";

}

var tlacitka = document.getElementsByClassName("hide");
for (var i = 0; i<tlacitka.length; i++ ){
tlacitka[i].onclick =hide;
}




</script>
</body>
</html>
16 changes: 12 additions & 4 deletions webface.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def info():

@app.route("/abc/")
def abc():
if 'uzivatel' not in session:
flash("Nejsi prihlasen blazne", "error")
return redirect(url_for("login", page = request.full_path))
return render_template("abc.html", slova=slova)


Expand All @@ -44,7 +47,7 @@ def abc():
def malina():
if 'uzivatel' not in session:
flash("Nejsi prihlasen blazne", "error")
return redirect(url_for("login"))
return redirect(url_for("login", page = request.full_path))

hmotnost = request.args.get('hmotnost')
vyska = request.args.get('vyska')
Expand Down Expand Up @@ -74,11 +77,16 @@ def login():
def login_post():
jmeno = request.form.get('jmeno')
heslo = request.form.get('heslo')
page = request.args.get("page")
if jmeno == "marek" and heslo == "lokomotiva":
flash("jsi přihlašen", "message")
session["uzivatel"] = jmeno



if page:
return redirect(page)
else:
flash("nespravne udaje", "error")
if page:
return redirect(url_for("login", page= page))
return redirect(url_for('login'))


Expand Down

0 comments on commit bfa6f38

Please sign in to comment.