Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggestion: please change the username column in auth_user from "name" to "domain" for weibo backend #164

Closed
sgxiao opened this issue Jan 17, 2014 · 1 comment

Comments

@sgxiao
Copy link

sgxiao commented Jan 17, 2014

Index: social/backends/weibo.py
===================================================================
--- social/backends/weibo.py    (revision 101)
+++ social/backends/weibo.py    (working copy)
@@ -27,7 +27,7 @@
         """Return user details from Weibo. API URL is:
         https://api.weibo.com/2/users/show.json/?uid=<UID>&access_token=<TOKEN>
         """
-        return {'username': response.get("name", ""),
+        return {'username': response.get("domain", ""),
                 'first_name': response.get('screen_name', '')}

please change the username column in admin from "name" to "domain" for weibo backend. the response key "name" from weibo usually contain chinese characters, which is not allow to be the username 's content of table auth_user. it may cause an invalid warning when people try to change it to another chinese word. the "domain" key contain an weibo account name whom the user register for themself as an identity string which always just contain english alphabet word [a-zA-Z]+ and digit [0-9]+ is a more proper choice for the username .

since i don't have the permission to merge this fix to the master branch, i wish someone can help me apply this fix code to the master branch.

@omab omab closed this as completed in 61fae87 Jan 18, 2014
@omab
Copy link
Owner

omab commented Jan 18, 2014

@sgxiao, I've added a setting to control this behavior keeping the name as the default value for backward compatibility. If you want to define the domain as the source of username it enough to define the setting SOCIAL_AUTH_WEIBO_DOMAIN_AS_USERNAME = True. Docs at http://psa.matiasaguirre.net/docs/backends/weibo.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants