Django rest auth email instead of username

后端 未结 2 797
没有蜡笔的小新
没有蜡笔的小新 2020-12-15 07:43

I have a django project in which I am using Django-rest-auth to do authentication. I want to use email with password to authenticate the user and n

2条回答
  •  被撕碎了的回忆
    2020-12-15 07:52

    I'm using this package too, and by call this config it worked for me:

    ACCOUNT_AUTHENTICATION_METHOD = 'email'
    

    Be careful about this config, this config belongs to django-allauth, see this:

    class AuthenticationMethod:
        USERNAME = 'username'
        EMAIL = 'email'
        USERNAME_EMAIL = 'username_email'
    

    The above class is the settings which is in allauth, so you should write 'EMAIL' in lower case.

提交回复
热议问题