mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
add aurweb.captcha, a CAPTCHA utility module
This CAPTCHA workflow is the same workflow used by our current PHP implementation of account registration. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
7a6a38592e
commit
df0a637d2b
3 changed files with 119 additions and 1 deletions
|
@ -12,7 +12,7 @@ from fastapi.responses import HTMLResponse
|
|||
|
||||
import aurweb.config
|
||||
|
||||
from aurweb import l10n, time
|
||||
from aurweb import captcha, l10n, time
|
||||
|
||||
# Prepare jinja2 objects.
|
||||
loader = jinja2.FileSystemLoader(os.path.join(
|
||||
|
@ -23,6 +23,10 @@ env = jinja2.Environment(loader=loader, autoescape=True,
|
|||
# Add tr translation filter.
|
||||
env.filters["tr"] = l10n.tr
|
||||
|
||||
# Add captcha filters.
|
||||
env.filters["captcha_salt"] = captcha.captcha_salt_filter
|
||||
env.filters["captcha_cmdline"] = captcha.captcha_cmdline_filter
|
||||
|
||||
|
||||
def make_context(request: Request, title: str, next: str = None):
|
||||
""" Create a context for a jinja2 TemplateResponse. """
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue