-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into add-mastodon-job-publisher
- Loading branch information
Showing
6 changed files
with
41 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{% load i18n %} | ||
{% spaceless %} | ||
<div class="form-group"> | ||
<label class="control-label">{{ label }}</label> | ||
<div class="form-group"> | ||
<div class="input-group mb-3"> | ||
<div class="input-group-prepend"> | ||
<img src="{{ image }}" alt="captcha" class="captcha" /> | ||
{% if audio %} | ||
<audio | ||
title="{% trans "Play CAPTCHA as audio file" %}" | ||
src="{{ audio }}" | ||
alt="captcha audio" | ||
controls | ||
style="display: block; padding-bottom: 1rem;" | ||
> | ||
{% endif %} | ||
</div> | ||
{% include "django/forms/widgets/multiwidget.html" %} | ||
</div> | ||
</div> | ||
</div> | ||
{% endspaceless %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
from allauth.account.forms import SignupForm | ||
from captcha.fields import CaptchaField | ||
from captcha.fields import CaptchaField, CaptchaTextInput | ||
|
||
|
||
class SingupFormWithCaptcha(SignupForm): | ||
captcha = CaptchaField() | ||
class CustomCaptchaTextInput(CaptchaTextInput): | ||
# HACK - No entiendo por qué esto apunta a community/templates y no al /templates en el root | ||
template_name = "account/custom_captcha.html" | ||
|
||
def image_url(self): | ||
# Agrego el "@2" para enviar un captcha con más resolucioón | ||
# https://django-simple-captcha.readthedocs.io/en/latest/advanced.html#captcha-2x-image | ||
return super().image_url().removesuffix("/") + "@2" | ||
|
||
|
||
class SignupFormWithCaptcha(SignupForm): | ||
captcha = CaptchaField(widget=CustomCaptchaTextInput) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.