Django rest-auth allauth registration with email, first and last name, and without username

Make sure you have ACCOUNT_USERNAME_REQUIRED = False in your settings.py file. For first_name and last_name you need to write a custom RegisterSerializer (https://github.com/iMerica/dj-rest-auth/blob/bf168d9830ca2e6fde56f83f46fe48ab0adc8877/dj_rest_auth/registration/serializers.py#L197) here’s a sample code for serializers.py from allauth.account import app_settings as allauth_settings from allauth.utils import email_address_exists from allauth.account.adapter import get_adapter from allauth.account.utils import setup_user_email class RegisterSerializer(serializers.Serializer): first_name = serializers.CharField(required=True, write_only=True) last_name = … Read more

Django allauth social login: automatically linking social site profiles using the registered email

Note (2018-10-23): I’m not using this anymore. Too much magic happening. Instead I enabled SOCIALACCOUNT_EMAIL_REQUIRED and ‘facebook’: { ‘VERIFIED_EMAIL’: False, … }. So allauth will redirect social logins on a social signup form to enter a valid email address. If it’s already registered an error shows up to login first and then connect the account. … Read more

Django allauth example [Errno 61] Connection refused

From allauth documentation: When I sign up I run into connectivity errors (connection refused et al) You probably have not got an e-mail (SMTP) server running on the machine you are developing on. Therefore, allauth is unable to send verification mails. You can work around this by adding the following line to settings.py: EMAIL_BACKEND = … Read more

How to customize user profile when using django-allauth

Suppose you want to ask the user for his first/last name during signup. You’ll need to put these fields in your own form, like so: class SignupForm(forms.Form): first_name = forms.CharField(max_length=30, label=”Voornaam”) last_name = forms.CharField(max_length=30, label=”Achternaam”) def signup(self, request, user): user.first_name = self.cleaned_data[‘first_name’] user.last_name = self.cleaned_data[‘last_name’] user.save() Then, in your settings point to this form: ACCOUNT_SIGNUP_FORM_CLASS … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)