django-allauth

IndexError, list index out of range. Django-allauth signals

帅比萌擦擦* 提交于 2019-12-02 17:53:45
问题 I'm using signals to update gender, when social user change their gender on facebook.com. Signals work fine. I can sign up and login and gender is updating for fb users. #app/models.py @receiver(user_signed_up) @receiver(user_logged_in) def set_gender(sender, **kwargs): user = kwargs.pop('user') extra_data = user.socialaccount_set.filter(provider='facebook')[0].extra_data gender = extra_data['gender'] if gender == 'male': user.gender = u'M' elif gender == 'female': user.gender = u'F' user

Passing a dynamic state parameter using django-allauth during social login

荒凉一梦 提交于 2019-12-02 17:19:35
问题 I need to pass data through a social authentication (so I can access it after the login is complete) using django-allauth, but I'm not sure how to go about doing this as the documentation seems to be completely lacking in this area. From what I gather, OAuth2 accepts a state parameter that can be used to transfer this sort of data. After spending hours trolling through the django-allauth code, it appears that there might be some ability to append a dynamic state parameter. However, I have no

django allauth facebook redirects to signup when retrieved email matches an existing user's email?

此生再无相见时 提交于 2019-12-02 17:14:46
I am successfully able to login via Google and Facebook using Django (1.6.4) and allauth (0.16.1) and Python (2.7) with expected redirect to settings.LOGIN_REDIRECT_URL in case when there isn't a existing user with emailid retrieved from provider. However, when there already exists an user with same emailid as the one retrieved from provider (fb or goolge), it always redirects to /accounts/social/signup/# = signup page asking: You are about to use your Facebook/Google account to login to example.com. As a final step, please complete the following form: Email is auto-filled. I have tested with

Plug in django-allauth as endpoint in django-rest-framework

别等时光非礼了梦想. 提交于 2019-12-02 15:36:23
I'm using django-allauth on my website for social logins. I also have a REST API powered by django-rest-framework that serves as the backend of a mobile app. Is there a way I can directly plug in allauth's authentication backend to the REST api so that I can validate (and register) users who use Facebook login in the mobile app? To clarify: The Facebook login part is handled by native SDKs. I need an endpoint that works like POST /user (that is, creates a new user), but takes Facebook oauth token as input instead of email/password etc. You can use this libray for social authentication django

Django Allauth not saving custom form

旧街凉风 提交于 2019-12-02 12:45:50
I am adding fields to the signup, the user is created and saved but the data aren't reaching the db. There is no custom User model. The additional fields go to a different table, it is a different model. settings.py SOCIALACCOUNT_AUTO_SIGNUP = False ACCOUNT_SIGNUP_FORM_CLASS = 'myapp.forms.UserDataForm' LOGIN_REDIRECT_URL = '/' SOCIALACCOUNT_QUERY_EMAIL = True SOCIALACCOUNT_PROVIDERS = { 'facebook': { 'SCOPE': ['email'], 'METHOD': 'js_sdk' # instead of 'oauth2' } } models.py from django.contrib.auth.models import User from django.db import models from django import forms class UserData(models

Keeping custom sign_up class and importing allauth forms in same forms.py file causing import errors

。_饼干妹妹 提交于 2019-12-02 11:37:28
问题 from django import forms from allauth.account.forms import (LoginForm, ChangePasswordForm, ResetPasswordForm, SetPasswordForm, ResetPasswordKeyForm) from django.contrib.auth import get_user_model from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions from django.core.urlresolvers import reverse class MySignupForm(forms.Form): class Meta: model = get

Passing a dynamic state parameter using django-allauth during social login

余生颓废 提交于 2019-12-02 09:44:51
I need to pass data through a social authentication (so I can access it after the login is complete) using django-allauth, but I'm not sure how to go about doing this as the documentation seems to be completely lacking in this area. From what I gather, OAuth2 accepts a state parameter that can be used to transfer this sort of data. After spending hours trolling through the django-allauth code, it appears that there might be some ability to append a dynamic state parameter . However, I have no idea what the proper way to introduce this data into the request is, nor at what point this should

IndexError, list index out of range. Django-allauth signals

送分小仙女□ 提交于 2019-12-02 09:05:58
I'm using signals to update gender, when social user change their gender on facebook.com. Signals work fine. I can sign up and login and gender is updating for fb users. #app/models.py @receiver(user_signed_up) @receiver(user_logged_in) def set_gender(sender, **kwargs): user = kwargs.pop('user') extra_data = user.socialaccount_set.filter(provider='facebook')[0].extra_data gender = extra_data['gender'] if gender == 'male': user.gender = u'M' elif gender == 'female': user.gender = u'F' user.save() But I've noticed that for normal accounts when I try to sign up at /accounts/signup or sign in at

How to add max_length to allauth username

谁都会走 提交于 2019-12-02 08:38:37
问题 I'm using Django allauth as my user account framework for my django site. The docs show there is an ACCOUNT_USERNAME_MIN_LENGTH however there is no ACCOUNT_USERNAME_MAX_LENGTH for some reason. Is there any way to create a max length for username? Here's my custom allauth signup form - maybe I can do something here?: class AllauthSignupForm(forms.Form): captcha = ReCaptchaField( public_key=config("RECAPTCHA_PUBLIC_KEY"), private_key=config("RECAPTCHA_PRIVATE_KEY"), ) class Meta: model = User

Django-allauth with multiple profile models

蓝咒 提交于 2019-12-01 08:39:18
I have a django project in which there are multiple profile models, each having a foreign key to the User model. It uses django-allauth for registration. Currently, when registering using a social account, the user registers, a User and a socialaccount is created, then the user is redirected to a form to fill out, depending on what profile type s/he chose earlier, and after filling out that form is the correct profile type created. I'd like it if the user, socialaccount and profile type instances are created in the same step, that is after the user fills out the profile specific form. Is there