dj-rest-auth icon indicating copy to clipboard operation
dj-rest-auth copied to clipboard

Wrong Documentation on Custom User Models

Open Bergiu opened this issue 4 years ago • 2 comments

I have a user model without username and only email and the following settings:

ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_USER_MODEL_USERNAME_FIELD = None
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_EMAIL_VERIFICATION = 'none'

For this to work, i need to add a custom LoginSerializer that set username = None:

class CustomLoginSerializer(serializers.LoginSerializer):
    username = None

Now when I open http://127.0.0.1:8000/dj-rest-auth/login/ the self describing api tells me in the description Accept the following POST parameters: username, password Return the REST Framework Token Object's key.

It should tell me to use the parameters: email and password not username.

I have found no way to replace the LoginView or to change the description.

Secondly it would be nice in dj-rest-auth to respect the above settings and automatically disable usernames if they are disabled.

Bergiu avatar Jan 29 '21 14:01 Bergiu

I'm also having this same issue. I'll be looking into it further for the next few days and I'll share any solutions I find if any

jerlendds avatar Feb 09 '21 15:02 jerlendds

Hey @jerlendds Did you find any solutions, please?

sreebash avatar Dec 08 '21 08:12 sreebash