django - Python-social-auth:禁用自动注册新用户

标签 django facebook python-social-auth

我在将 PSA 设置为在登录时不注册新用户时遇到问题。 documentation说:

可以通过定义设置 SOCIAL_AUTH_PIPELINE 来覆盖它,例如,一个不会创建用户、只接受已注册用户的管道,如下所示:

SOCIAL_AUTH_PIPELINE = (
    'social.pipeline.social_auth.social_user',
    'social.pipeline.social_auth.associate_user',
    'social.pipeline.social_auth.load_extra_data',
    'social.pipeline.user.user_details'
)

我将此代码添加到我的设置中,尝试使用已注册的用户通过 Facebook 登录,然后我会重定向到默认的 /accounts/login/#_=_ 页面。

使用默认管道设置,一切正常,我可以登录。

最佳答案

正如 omab 指出的,工作代码是

SOCIAL_AUTH_PIPELINE = (
    'social.pipeline.social_auth.social_details', 
    'social.pipeline.social_auth.social_uid',      
    'social.pipeline.social_auth.auth_allowed',
    'social.pipeline.social_auth.social_user',
    'social.pipeline.social_auth.associate_user',
    'social.pipeline.social_auth.load_extra_data',
    'social.pipeline.user.user_details'
 )`

关于django - Python-social-auth:禁用自动注册新用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24097361/

相关文章:

python - 循环模板的键值 - Django查询

python - 连接 django-select2 与 django-filters

django - 如何在Django中的模型上使用error_messages

Facebook - 如何通过 URL 上传照片?

python - 没有名为 'rest_frameworkoauth2_provider' 的模块

css - 来自带有django的静态文件的css样式的背景图像

java.lang.ClassNotFoundException : com. facebook.unity.FB 每当我测试我的构建时

node.js - Messenger 发送 API + AWS S3 托管对象

Python Social Auth - 使用 Google 身份验证时导入错误

python - 如何在给定 OAuth2 access_token 的情况下授权 Python Google API 客户端服务?