Skip to content

Commit

Permalink
Adds Google Captcha into allauth Sign Up form.
Browse files Browse the repository at this point in the history
  • Loading branch information
mojeto committed Jan 30, 2018
1 parent b36dd2b commit d4f170d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contrib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
2 changes: 2 additions & 0 deletions contrib/allauth/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
2 changes: 2 additions & 0 deletions contrib/allauth/account/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
20 changes: 20 additions & 0 deletions contrib/allauth/account/form.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals

from captcha.fields import ReCaptchaField
from django import forms

from core.utilities import has_recaptcha


class BaseSignUpForm(forms.Form):
field_order = ['email', 'username', 'password1', 'password2', 'captcha']

if has_recaptcha():
captcha = ReCaptchaField(label='')

def signup(self, request, user):
"""
Invoked at signup time to complete the signup of the user.
"""
pass
1 change: 1 addition & 0 deletions madewithwagtail/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,4 @@
# allauth configuration
ACCOUNT_EMAIL_REQUIRED = True # we want to send page published confirmation email to the user
ACCOUNT_AUTHENTICATED_LOGIN_REDIRECTS = False # prevent redirect loop in case user log in without permissions
ACCOUNT_SIGNUP_FORM_CLASS = 'contrib.allauth.account.form.BaseSignUpForm'

0 comments on commit d4f170d

Please sign in to comment.