mirror of
https://git.ari.lt/ari.lt/ari.lt.git
synced 2025-02-04 17:49:24 +01:00
remove captcha
Signed-off-by: Ari Archer <ari@ari.lt>
This commit is contained in:
parent
d1ffe5aa98
commit
23a3e3542f
6 changed files with 6 additions and 46 deletions
|
@ -1,7 +1,6 @@
|
||||||
flask
|
flask
|
||||||
types-flask
|
types-flask
|
||||||
flask-sqlalchemy
|
flask-sqlalchemy
|
||||||
flask-ishuman
|
|
||||||
crc4
|
crc4
|
||||||
validators
|
validators
|
||||||
markdown
|
markdown
|
||||||
|
|
|
@ -69,10 +69,6 @@ def create_app(name: str) -> flask.Flask:
|
||||||
|
|
||||||
app.register_blueprint(views, url_prefix="/")
|
app.register_blueprint(views, url_prefix="/")
|
||||||
|
|
||||||
from .c import c
|
|
||||||
|
|
||||||
c.init_app(app)
|
|
||||||
|
|
||||||
app.jinja_env.filters["markdown"] = util.markdown_to_html # type: ignore
|
app.jinja_env.filters["markdown"] = util.markdown_to_html # type: ignore
|
||||||
|
|
||||||
web_mini.compileall()
|
web_mini.compileall()
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""Captcha"""
|
|
||||||
|
|
||||||
import flask_ishuman
|
|
||||||
|
|
||||||
c: flask_ishuman.IsHuman = flask_ishuman.IsHuman()
|
|
|
@ -11,7 +11,6 @@ import validators
|
||||||
from werkzeug.wrappers import Response
|
from werkzeug.wrappers import Response
|
||||||
|
|
||||||
from . import email, models, util
|
from . import email, models, util
|
||||||
from .c import c
|
|
||||||
from .routing import Bp
|
from .routing import Bp
|
||||||
|
|
||||||
views: Bp = Bp("views", __name__)
|
views: Bp = Bp("views", __name__)
|
||||||
|
@ -110,7 +109,9 @@ Deletion token:
|
||||||
def delete(comment_id: int, token: str):
|
def delete(comment_id: int, token: str):
|
||||||
"""delete a comment"""
|
"""delete a comment"""
|
||||||
|
|
||||||
comment: models.Comment = models.Comment.query.filter_by(id=comment_id, token=token).first_or_404()
|
comment: models.Comment = models.Comment.query.filter_by(
|
||||||
|
id=comment_id, token=token
|
||||||
|
).first_or_404()
|
||||||
|
|
||||||
models.db.session.delete(comment)
|
models.db.session.delete(comment)
|
||||||
models.db.session.commit()
|
models.db.session.commit()
|
||||||
|
@ -124,13 +125,10 @@ def delete(comment_id: int, token: str):
|
||||||
def comment():
|
def comment():
|
||||||
"""publish a comment"""
|
"""publish a comment"""
|
||||||
|
|
||||||
for field in "name", "email", "comment", "code":
|
for field in "name", "email", "comment":
|
||||||
if field not in flask.request.form:
|
if field not in flask.request.form:
|
||||||
flask.abort(400)
|
flask.abort(400)
|
||||||
|
|
||||||
if not c.verify(flask.request.form["code"]): # type: ignore
|
|
||||||
flask.abort(403)
|
|
||||||
|
|
||||||
if not validators.email(flask.request.form["email"]):
|
if not validators.email(flask.request.form["email"]):
|
||||||
flask.abort(400)
|
flask.abort(400)
|
||||||
|
|
||||||
|
@ -273,12 +271,6 @@ def counter() -> flask.Response:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@views.get("/captcha.png")
|
|
||||||
def captcha() -> flask.Response:
|
|
||||||
"""CAPTCHA"""
|
|
||||||
return flask.Response(c.new().rawpng(), mimetype="image/png")
|
|
||||||
|
|
||||||
|
|
||||||
@views.get("/badge.png")
|
@views.get("/badge.png")
|
||||||
def badge() -> Response:
|
def badge() -> Response:
|
||||||
"""Website badge"""
|
"""Website badge"""
|
||||||
|
|
|
@ -101,18 +101,6 @@ form > button {
|
||||||
min-height: 3em;
|
min-height: 3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.captcha {
|
|
||||||
display: -ms-grid;
|
|
||||||
display: grid;
|
|
||||||
place-items: center;
|
|
||||||
margin: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.captcha > img {
|
|
||||||
display: block;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
#comments > div {
|
#comments > div {
|
||||||
background-color: #111;
|
background-color: #111;
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
|
@ -152,10 +140,12 @@ form > button {
|
||||||
-ms-flex-align: unset;
|
-ms-flex-align: unset;
|
||||||
align-items: unset;
|
align-items: unset;
|
||||||
}
|
}
|
||||||
|
|
||||||
.split > *:nth-child(1) {
|
.split > *:nth-child(1) {
|
||||||
-ms-grid-row: 1;
|
-ms-grid-row: 1;
|
||||||
-ms-grid-column: 1;
|
-ms-grid-column: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.split > *:nth-child(2) {
|
.split > *:nth-child(2) {
|
||||||
-ms-grid-row: 3;
|
-ms-grid-row: 3;
|
||||||
-ms-grid-column: 1;
|
-ms-grid-column: 1;
|
||||||
|
|
|
@ -431,16 +431,6 @@
|
||||||
<textarea required type="text" id="comment" name="comment" placeholder="Hello! I like your website - <https://ari.lt/>."></textarea>
|
<textarea required type="text" id="comment" name="comment" placeholder="Hello! I like your website - <https://ari.lt/>."></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="captcha">
|
|
||||||
<img loading="lazy" width="240px" height="90" src="{{ url_for("views.captcha") }}?new" onclick="this.src=this.src+Math.floor(1000*Math.random())" alt="An image CAPTCHA" />
|
|
||||||
<i>Click the image above to reload and get a new CAPTCHA.</i>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="captcha">CAPTCHA:</label>
|
|
||||||
<input required type="text" id="code" name="code" placeholder="Enter the CAPTCHA code above." />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="agree">Email Policy Agreement:</label>
|
<label for="agree">Email Policy Agreement:</label>
|
||||||
<input required type="checkbox" id="agree" name="agree" />
|
<input required type="checkbox" id="agree" name="agree" />
|
||||||
|
|
Loading…
Add table
Reference in a new issue