简体   繁体   中英

Django unique “username” when using local user authentication and “Django Social auth” application

I am using Django local user registration as well as some social media authentication using Django-social_auth webapp. When I go to user table to check the usernames, It looks to me that Django might compromise the uniqueness of the username. For example, if i have two emails "abcdef@gmail.com" and "abcdef@yahoo.com" how would it store such things in the user table as it stores "abcdef" part in the username column.

python-social-auth will attempt to build a unique username when a collision is detected, relevant code is here .

There are also options to "cleanup" a username by defining the SOCIAL_AUTH_CLEAN_USERNAME_FUNCTION .

And you can also define your custom get_username pipeline function that can fit better on your project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM