Added new setting, widget, form and auth backend to allow login via user email address

To enable:
AUTHENTICATION_BACKENDS = ('common.auth.email_auth_backend.EmailAuthBackend',)
COMMON_LOGIN_METHOD = 'email'
This commit is contained in:
Roberto Rosario
2011-08-05 23:36:00 -04:00
parent acd6348dd7
commit 36c7beca84
7 changed files with 92 additions and 5 deletions

View File

@@ -83,3 +83,16 @@ class TextAreaDiv(forms.widgets.Widget):
conditional_escape(force_unicode(value))))
return mark_safe(result.replace('\n', '<br>'))
# From: http://www.peterbe.com/plog/emailinput-html5-django
class EmailInput(forms.widgets.Input):
input_type = 'email'
def render(self, name, value, attrs=None):
if attrs is None:
attrs = {}
attrs.update(dict(autocorrect='off',
autocapitalize='off',
spellcheck='false'))
return super(EmailInput, self).render(name, value, attrs=attrs)