Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
comanage-registry-docker/comanage-registry-mailman/web/django-mail-header/src/django_mail_header/backends.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
16 lines (13 sloc)
441 Bytes
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
""" | |
Django backend that uses the RemoteUserBackend as a base | |
class and that sets the email field on the user model | |
to be the same as the username field each time a new | |
user is created. | |
""" | |
from django.contrib.auth.backends import RemoteUserBackend | |
class MailHeaderBackend(RemoteUserBackend): | |
def configure_user(self, user): | |
username = user.get_username() | |
user.email = username; | |
user.save() | |
return user |