Add captcha_factor
This commit is contained in:
3
passbook/captcha_factor/__init__.py
Normal file
3
passbook/captcha_factor/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
"""passbook captcha_factor Header"""
|
||||
__version__ = '0.0.1-alpha'
|
||||
default_app_config = 'passbook.captcha_factor.apps.PassbookCaptchaFactorConfig'
|
||||
9
passbook/captcha_factor/apps.py
Normal file
9
passbook/captcha_factor/apps.py
Normal file
@ -0,0 +1,9 @@
|
||||
"""passbook captcha app"""
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class PassbookCaptchaFactorConfig(AppConfig):
|
||||
"""passbook captcha app"""
|
||||
|
||||
name = 'passbook.captcha_factor'
|
||||
label = 'passbook_captcha_factor'
|
||||
15
passbook/captcha_factor/factor.py
Normal file
15
passbook/captcha_factor/factor.py
Normal file
@ -0,0 +1,15 @@
|
||||
"""passbook captcha factor"""
|
||||
|
||||
from django.views.generic import FormView
|
||||
|
||||
from passbook.captcha_factor.forms import CaptchaForm
|
||||
from passbook.core.auth.factor import AuthenticationFactor
|
||||
|
||||
|
||||
class CaptchaFactor(FormView, AuthenticationFactor):
|
||||
"""Simple captcha checker, logic is handeled in django-captcha module"""
|
||||
|
||||
form_class = CaptchaForm
|
||||
|
||||
def form_valid(self, form):
|
||||
return self.authenticator.user_ok()
|
||||
9
passbook/captcha_factor/forms.py
Normal file
9
passbook/captcha_factor/forms.py
Normal file
@ -0,0 +1,9 @@
|
||||
"""passbook captcha factor forms"""
|
||||
from captcha.fields import ReCaptchaField
|
||||
from django import forms
|
||||
|
||||
|
||||
class CaptchaForm(forms.Form):
|
||||
"""passbook captcha factor form"""
|
||||
|
||||
captcha = ReCaptchaField()
|
||||
1
passbook/captcha_factor/requirements.txt
Normal file
1
passbook/captcha_factor/requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
django-recaptcha
|
||||
7
passbook/captcha_factor/settings.py
Normal file
7
passbook/captcha_factor/settings.py
Normal file
@ -0,0 +1,7 @@
|
||||
"""passbook captcha_facot settings"""
|
||||
RECAPTCHA_PUBLIC_KEY = '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI'
|
||||
RECAPTCHA_PRIVATE_KEY = '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe'
|
||||
NOCAPTCHA = True
|
||||
INSTALLED_APPS = [
|
||||
'captcha'
|
||||
]
|
||||
Reference in New Issue
Block a user