Django-Registration: Email as username

前端 未结 3 1775
攒了一身酷
攒了一身酷 2021-01-29 23:51

How do I use emails instead of username for authentication using django-registration.

Further how do I enforce this change once I have already installed the registration

3条回答
  •  没有蜡笔的小新
    2021-01-30 00:11

    For Django >= 1.3 and < 1.5 there's Django email as username on github.

    Recently I'm using registration and I switch easily to django-registration-email. It works fine on Django 1.4, reusing the same templates and simply adding REGISTRATION_EMAIL_ACTIVATE_SUCCESS_URL = "/profiles/create/" to redirect to the profile creation page.

    Django 1.5 overcome this issue through custom User model where you can specify what field is used as username. As stated in Django 1.5 documentation:

    A string describing the name of the field on the User model that is used as the unique identifier. This will usually be a username of some kind, but it can also be an email address, or any other unique identifier.

提交回复
热议问题