Closed ryulstory closed 7 years ago
Any user who registers on my homepage directly can access the homepage (which requires the user to be logged in). But a user who registers with python-social-auth can log in, but can't @@access the homepage.
This is my settings.py
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sites', 'photo', 'authentication', 'social_django', 'social.apps.django_app.default', 'pipeline', 'debug_toolbar', ] MIDDLEWARE = [ 'django.contrib.sessions.middleware.SessionMiddleware', 'social.apps.django_app.middleware.SocialAuthExceptionMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'social_django.middleware.SocialAuthExceptionMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware', ] 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.apps.django_app.context_processors.backends', 'social.apps.django_app.context_processors.login_redirect', ], }, }, ] AUTHENTICATION_BACKENDS = ( 'social.backends.kakao.KakaoOAuth2', 'django.contrib.auth.backends.ModelBackend', ) PIPELINE = { 'PIPELINE_ENABLED': True, 'JAVASCRIPT': { 'stats': { 'source_filenames': ( 'js/jquery.js', 'js/d3.js', 'js/collections/*.js', 'js/application.js', ), 'output_filename': 'js/stats.js', } } } 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.user.get_username', 'social.pipeline.user.user_details', 'authentication.social.require_info', 'social.pipeline.mail.mail_validation', 'social.pipeline.social_auth.associate_by_email', 'social.pipeline.user.create_user', 'social.pipeline.social_auth.associate_user', 'social.pipeline.social_auth.load_extra_data', ) SOCIAL_AUTH_DISCONNECT_PIPELINE = ( 'social.pipeline.disconnect.allowed_to_disconnect', 'social.pipeline.disconnect.get_entries', 'social.pipeline.disconnect.revoke_tokens', 'social.pipeline.disconnect.disconnect', ) SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer' SOCIAL_AUTH_KAKAO_KEY ='d3b5de655df7bbfc85916336a9c4a479' SOCIAL_AUTH_KAKAO_SECRET = '' SOCIAL_AUTH_ADMIN_USER_SEARCH_FIELDS = ['username', 'email'] SOCIAL_AUTH_SLUGIFY_USERNAMES = True SOCIAL_AUTH_LOGIN_REDIRECT_URL ='/home' SOCIAL_AUTH_LOGIN_URL ='/accounts.kakao.com/login' SOCIAL_AUTH_URL_NAMESPACE = 'social' SESSION_EXPIRE_AT_BROWSER_CLOSE = True
this is urls.py
#login url(r'^accounts/login/$', auth_views.login, {'template_name':'registration/login.html', 'authentication_form': LoginForm}, name='login'), url(r'^accounts/logout/$', auth_views.logout, {'next_page':'/accounts/login'}, name='logout'), url('', include('social.apps.django_app.urls', namespace='social')), url(r'^accounts/register/$', UserCreateView.as_view(), name='register'), url(r'^accounts/getinfo/$', authentication_views.acquire_info, name='acquire_info'), ]
this is templates
<div class="container"> <div class="center-form panel"> <div class="panel-body"> <h4 class="text-center"><i class="ion-log-in"></i>Log in</h4> <form method="post" action="{% url 'login' %}"> {% csrf_token %} <div class="form-group has-feedback"> <p>{{user.username}} 반갑습니다.</p> {{ form.username }} <span class="ion-person form-control-feedback"></span> </div> <div class="form-group has-feedback"> {{ form.password }} <span class="ion-key form-control-feedback"></span> </div> <button type="submit" class="btn btn-block btn-success" value="login">Log in</button> <br /> <p class="text-center text-muted"> <small>Don't have an account yet? <a href="{% url 'register' %}">Sign up</a></small> </p> <div class="signup-or-separator"> <h6 class="text">or</h6> <hr> </div> <input type="hidden" name="next" value="{{next}}" /> </form> <a href="{% url 'social:begin' backend='kakao' %}?next={{request.path}}" class="btn btn-block btn-kakao"> 카카오계정으로 로그인 </a> </div> </div> </div>
i attach files showed information when i login with kakao(python-social-auth)
How do you check if somebody has access to that page? Also, why is the next value different for form-login and social-login?
next
Please move this ticket to https://github.com/python-social-auth/social-app-django
Any user who registers on my homepage directly can access the homepage (which requires the user to be logged in). But a user who registers with python-social-auth can log in, but can't @@access the homepage.
This is my settings.py
this is urls.py
this is templates
i attach files showed information when i login with kakao(python-social-auth)