mirror of
https://github.com/csd4ni3l/grass_touching_captcha.git
synced 2026-01-01 12:33:45 +01:00
add unathorized access flash
This commit is contained in:
5
main.py
5
main.py
@@ -1,4 +1,4 @@
|
|||||||
from flask import Flask, redirect, url_for, render_template, request, Response, send_from_directory, g
|
from flask import Flask, redirect, url_for, render_template, request, Response, send_from_directory, g, flash, get_flashed_messages
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from constants import RICKROLL_LINK, UPLOAD_DIR, MINIMUM_COSINE_SIMILARITY, DATABASE_FILE
|
from constants import RICKROLL_LINK, UPLOAD_DIR, MINIMUM_COSINE_SIMILARITY, DATABASE_FILE
|
||||||
from jina import get_grass_touching_similarity
|
from jina import get_grass_touching_similarity
|
||||||
@@ -86,7 +86,8 @@ def login():
|
|||||||
return redirect(url_for("iamarealpersonwhotouchedgrass"))
|
return redirect(url_for("iamarealpersonwhotouchedgrass"))
|
||||||
else:
|
else:
|
||||||
cur.close()
|
cur.close()
|
||||||
return Response("Unathorized access. Just go outside, touch grass and make your own account...")
|
flash("Unathorized access. Just go outside, touch grass and make your own account...", "error")
|
||||||
|
return render_template("unathorized.jinja2")
|
||||||
|
|
||||||
@app.route("/register", methods=["GET", "POST"])
|
@app.route("/register", methods=["GET", "POST"])
|
||||||
def register():
|
def register():
|
||||||
|
|||||||
13
templates/unathorized.jinja2
Normal file
13
templates/unathorized.jinja2
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{% extends "base.jinja2" %}
|
||||||
|
{% block title %}Grass Touching Unathorized{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
{% with messages = get_flashed_messages()%}
|
||||||
|
{% if messages%}
|
||||||
|
{% for message in messages%}
|
||||||
|
<p>{{message}}</p>
|
||||||
|
{%endfor%}
|
||||||
|
{%endif%}
|
||||||
|
{%endwith%}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user