2017-07-27 2 views
0

これは非常に奇妙なことです、誰もそれを修正する方法を知っていますか?なぜ、python-social-authは、私が蒸気でログインするたびに、first_nameとlast_nameフィールドを削除していますか?

これは私がユーザーの作成を排除し、外部のソーシャルネットワークを残したいからです。

Twitch.tvも実装しますが、削除してもテストしていません。

ログイン(テンプレート): ここでは、ドキュメントに表示されているとおりにボタンを配置します。

<a class="btn btn-steam" href="{% url "social:begin" "steam" %}" role="button"><i class="fa fa-steam" aria-hidden="true"></i> Login with Steam</a> 

class UserLogin(TemplateView): 
    success_url = 'timeline' 
    template_name = 'registration/login.html' 

views.pyログインSettings.py

import os 
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 
DEBUG = True 
ALLOWED_HOSTS = ['127.0.0.1','plxapp.herokuapp.com'] 
INSTALLED_APPS = [ 
    'django.contrib.admin', 
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
    'easy_thumbnails', 
    'social_django', 
    'core.apps.CoreConfig', 
    'userprofile.apps.UserProfileConfig', 
    'posts.apps.PostsConfig', 
    'posts.templatetags.custom_filters', 
] 
MIDDLEWARE = [ 
    'django.middleware.security.SecurityMiddleware', 
    'django.contrib.sessions.middleware.SessionMiddleware', 
    'django.middleware.common.CommonMiddleware', 
    'django.middleware.csrf.CsrfViewMiddleware', 
    'django.contrib.auth.middleware.AuthenticationMiddleware', 
    'django.contrib.messages.middleware.MessageMiddleware', 
    'django.middleware.clickjacking.XFrameOptionsMiddleware', 
] 
ROOT_URLCONF = 'plaxed.urls' 
TEMPLATES = [ 
    { 
     'BACKEND': 'django.template.backends.django.DjangoTemplates', 
     'DIRS': [os.path.join(BASE_DIR, 'templates')], 
     'APP_DIRS': True, 
     'OPTIONS': { 
      'context_processors': [ 
       'django.template.context_processors.debug', 
       'django.template.context_processors.request', 
       'django.contrib.auth.context_processors.auth', 
       'django.contrib.messages.context_processors.messages', 
       'social_django.context_processors.backends', 
       'social_django.context_processors.login_redirect', 
      ], 
     }, 
    }, 
] 
WSGI_APPLICATION = 'plaxed.wsgi.application' 
DATABASES = { 
    'default': { 
     'ENGINE': 'django.db.backends.sqlite3', 
     'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 
    } 
} 
AUTH_PASSWORD_VALIDATORS = [ 
    { 
     'NAME':  'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 
    }, 
    { 
     'NAME':  'django.contrib.auth.password_validation.MinimumLengthValidator', 
    }, 
    { 
     'NAME':  'django.contrib.auth.password_validation.CommonPasswordValidator', 
    }, 
    { 
     'NAME':  'django.contrib.auth.password_validation.NumericPasswordValidator', 
    }, 
] 
LANGUAGE_CODE = 'en-us' 
TIME_ZONE = 'America/Bogota' 
USE_I18N = True 
USE_L10N = True 
USE_TZ = True 
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') 
STATIC_URL = '/static/' 
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),) 
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') 
MEDIA_URL = '/media/' 
LOGIN_REDIRECT_URL = 'timeline' 
import dj_database_url 
db_from_env = dj_database_url.config() 
DATABASES['default'].update(db_from_env) 
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage' 
THUMBNAIL_ALIASES = { 
    '': { 
     'post': {'size': (555, 0), 'crop': 'smart', 'upscale' : True}, 
     'header': {'size': (1170, 350), 'crop': 'smart', 'upscale' : True}, 
     'avatar': {'size': (200, 200), 'crop': 'smart', 'upscale' : True}, 
     'avatar_thumb': {'size': (50, 50), 'crop': 'smart', 'upscale' : True}, 
    }, 
} 
SOCIAL_AUTH_LOGIN_REDIRECT_URL = 'timeline' 
SOCIAL_AUTH_LOGIN_ERROR_URL = 'login' 
SOCIAL_AUTH_LOGIN_URL = 'index' 
SOCIAL_AUTH_NEW_USER_REDIRECT_URL = 'userprofile_basic' 
SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = 'timeline' 
SOCIAL_AUTH_DISCONNECT_REDIRECT_URL = 'login' 
SOCIAL_AUTH_INACTIVE_USER_URL = 'index' 
SOCIAL_AUTH_USER_MODEL = 'auth.User' 
AUTHENTICATION_BACKENDS = (
    'social_core.backends.open_id.OpenIdAuth', 
    'social_core.backends.steam.SteamOpenId', 
    'django.contrib.auth.backends.ModelBackend', 
) 
SOCIAL_AUTH_PIPELINE = (
    'social_core.pipeline.social_auth.social_details', 
    'social_core.pipeline.social_auth.social_uid', 
    'social_core.pipeline.social_auth.social_user', 
    'social_core.pipeline.user.get_username', 
    'social_core.pipeline.user.create_user', 
    'social_core.pipeline.social_auth.associate_user', 
    'social_core.pipeline.social_auth.load_extra_data', 
    'social_core.pipeline.user.user_details', 
    'social_core.pipeline.social_auth.associate_by_email', 
) 
SOCIAL_AUTH_ADMIN_USER_SEARCH_FIELDS = ['username', 'first_name', 'email'] 
SOCIAL_AUTH_STEAM_API_KEY = 'a key' 
SOCIAL_AUTH_STEAM_EXTRA_DATA = ['player'] 

答えて

0

そのPythonの社会的な認証のバグ、私はジャンゴ・allauth

のためにそれを変更解決していません
関連する問題