django-allauth

Django-allauth: custom signup form for socialaccount

天大地大妈咪最大 提交于 2019-12-06 04:07:58
问题 I have found in this question (and the doc) that one can use ACCOUNT_SIGNUP_FORM_CLASS to define some custom form field presented during account registration. However, this form does not seem to appear in the flow of using a social account (at least not by default). Is there a way to have it, or to easily customize some handlers so that I could introduce such step ? Otherwise, this would give a quite non-unified signup process (people using social accounts would have to go and fill the

django-allauth: rearrange form fields (change order)

你说的曾经没有我的故事 提交于 2019-12-06 02:30:30
问题 I am trying to use django-allauth for user registrations. I have this form class UserProfileForm(forms.ModelForm): class Meta: model = UserProfile fields = ('gender', 'country', 'city', 'birth_date', 'has_accepted_tos') and as per instructions I have set in my settings.py ACCOUNT_SIGNUP_FORM_CLASS = "userprofile.forms.UserProfileForm" The problem is that when the form is rendered my custom form asking for gender, country etc is rendered on top and then the standard User fields that ask for

My 'access_token' from facebook is “incorrect value”

雨燕双飞 提交于 2019-12-05 18:43:33
I'm using django-rest-auth which is "API extension for Django all-auth". I'm building a mobile app which can signup/login using Facebook token (url: http://localhost:8000/rest-auth/facebook/ ). get Facebook token using 'expo' export const doFacebookLogin = () => async dispatch => { let { type, token } = await Facebook.logInWithReadPermissionsAsync('194632xxxxxx', { permissions: ['public_profile'] }); if (type === 'cancel') { return dispatch({ type: FACEBOOK_LOGIN_CANCEL }) } doSocialAuthLogin(dispatch, token); }; Include token in Http POST request const doSocialAuthLogin = async (dispatch,

How does email translation work with django allauth?

流过昼夜 提交于 2019-12-05 18:23:57
I'm using the most excellent django-allauth to handle authentication. All is well, but I have an issue with the email translations. First, allauth is definitely using my template. I ran: django-admin.py makemessages -l ir -i settings.py This created: my_app/locale/ir/LC_MESSAGES/django.po In django.po, I make this change: templates/account/email/email_confirmation_subject.txt:3 msgid "Confirm E-mail Address" msgstr "FARSI Confirm E-mail Address" Then to test, a user signs up on a page where the language is set (), but the email sent is not using what I put in the msgstr above. I'd like to know

Override templates of external app in Django

╄→гoц情女王★ 提交于 2019-12-05 16:55:33
问题 I want to override the templates of an external app (allauth, installed in site packages). Unfortunately no advice i read worked. I added the following to my settings.py : PROJECT_ROOT = os.path.normpath(os.path.dirname(os.path.abspath(__file__))) TEMPLATE_DIRS = (os.path.join(PROJECT_ROOT, 'templates', 'allauth')) and copied all templates (this content) to my_project_dir/templates/allauth . But when I restart the server and reload the page I only get the rendered templates from the original

Prevent social account creation in allauth

痞子三分冷 提交于 2019-12-05 13:26:36
Is it possible to prevent account creation under certain circumstances in allauth, preferably using the pre_social_login signal? With the current development branch you can easily do this. In your settings: SOCIALACCOUNT_ADAPTER = 'my.adapter.MySocialAccountAdapter' Then use this adapter.py: from django.http import HttpResponse from allauth.socialaccount.adapter import DefaultSocialAccountAdapter from allauth.exceptions import ImmediateHttpResponse class MySocialAccountAdapter(DefaultSocialAccountAdapter): def pre_social_login(self, request, sociallogin): raise ImmediateHttpResponse

Allauth verified user

大憨熊 提交于 2019-12-05 12:48:09
I'm using django 1.6 with allauth. I've just enabled the email verification stuff and am looking for the best way to identify if a user has a verified email or not . One interesting thing I encountered and wanted to ask about: I noticed that a user can have several email addresses. Why is it so? this makes the above test a bit more complicated since you have to ask "does the user have at least one verified email address?" allauth offers a decorator for this: from allauth.account.decorators import verified_email_required @verified_email_required def verified_users_only_view(request): ...

Django Allauth Login instead of Signup

让人想犯罪 __ 提交于 2019-12-05 09:51:23
问题 I am using Django allauth for providing social login using GitHub and google. I have users already registered. I have to log in the users based on their emails. Firstly I tried authenticating with google, and it redirected me to a link /accounts/social/signup/ It prompted me a form with username and email of the user (the email column is already filled). If I give some username and click submit it creates a new user of that form. Instead of logging the current user. I am not understanding

django-allauth: Module “accounts.forms” does not define a “SignupForm” class

自闭症网瘾萝莉.ら 提交于 2019-12-05 08:38:56
I am getting the following error: django.core.exceptions.ImproperlyConfigured: Module "accounts.forms" does not define a "SignupForm" class settings.py (...) ACCOUNT_SIGNUP_FORM_CLASS = 'accounts.forms.SignupForm' (...) accounts/forms.py from allauth.account.forms import BaseSignupForm class SignupForm(BaseSignupForm): def __init__(self, *args, **kwargs): self.sociallogin = kwargs.pop('sociallogin') user = self.sociallogin.account.user first_name = forms.CharField(label=_('First name'), max_length=30, min_length=2, widget=forms.TextInput(attrs={ 'placeholder':_('First name')})) last_name =

Login / register using phone or email for django, allauth integration

瘦欲@ 提交于 2019-12-05 08:36:51
I want to modify my django user model to allow phone or email registration / login. Using USERNAME_FIELD = 'identifier' If the user registers with phone number, the identifier will be its phone number, or email, vice versa. (If anyone think I should just assign some number as the identifier, let me know.) Here is my accounts.models: from django.db import models from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager from phonenumber_field.modelfields import PhoneNumberField class UserManager(BaseUserManager): def create_user(self, email, phone, password, *