How to add extra fields after fb auth in Django allauth - django

How to add an extra field to django allauth registration flow.
1. First step- Django allauth registration using email or fblogin (this is working for me, the user is able to register through facebook or email)
2. I want to add the following fields/attributes to the user registration but as a second step.
The new attributes are 1. DOB, Address, Phone no, Linkedin login and a user profile score

Answer to block one can be found here
How to customize user profile when using django-allauth
for Block 2,
Add this to your settings.py
INSTALLED_APPS = ('allauth.socialaccount.providers.linkedin',
)

Related

Cannot login to django admin by a created staff

I have created a superuser in my django project that access to all of the permissions of the admin page. The problem is that when I add an object to the customized user model and set is_staff = true for that new user and then logout from the admin, I cannot login with the staff user account due to the error that says “please enter correct username and password for the staff account” despite the matter that the username and password of that staff user are right.
I will thank if anyone help me to solve this problem
Have you told your django app that this user class is your user model?
To do so, you need to set AUTH_USER_MODEL in your app's settings. This is described in more detail here in the Django documentation.

User registration with admin authorization

I was wonder if it is possible to include a way that when someone fill the user registration form to register, can the details be sent to an admin email for authorization before the user can login in django?
Since you did not provide any code I will guide you the process, you can later come back more specific question if you are stuck :
Use the field is_active provided by Django from the User model to authorised access within your website.
Extends the field is_active to set the default to False or set it to false in the begging of your user view
Create a link with the ID of the user and a path to the Django Admin where you can update the user and active to True
In short yes, possible and pretty easy if you know a bit of Django.

How to link social app's avatar with django user model using django-allauth

I have created Facebook and Twitter authentication with django-allauth. It is working fine as for authentication and I know how to extract logged in user's avatar with this code.
'user.socialaccount_set.all.0.get_avatar_url '
However, what I want to do is extract all user's avatar from User model but above code only gives me one user's avatar.
I guess I have to link user's avatar with django's User model or store it somewhere.
Could anyone teach me how to do that?
Ref:
http://django-allauth.readthedocs.io/en/latest/index.html

multiple devise models with multiple login pages

I created three devise models user, admin, trainer. For user and admin i want login with email and password. For trainer I want login with username and password. How we can achieve this ?
Your Users and Admin should already be logging in with email and password by default with Devise.
To set up login with username for your Trainers checkout this link.
https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign-in-using-their-username-or-email-address
This will allow your Trainers to login with either username or email. You can display either on the pages because we are adding a username migration to the trainers model.
You will also need to add field to the Trainer signup page.

django-allauth passwords with social registration

Basically, the goal is to have valid username/password pair for each registered user.
I think the proper way to do that is to create custom form for social signup.The default workflow for social signup is:
User clicks "Sign in with PROVIDER_NAME";
User gives access to my app on provider's site;
Site redirects him to my app where he should fill additional fields like username etc. and complete registration.
And I need to ask user for passwords too at the last step. Form should validate that passwords and save it to user.
Any ideas? Have no idea how can it be implemented with custom form or adapter.
The purpose of allauth, is to avoid the user to create a new username/password for your site.
However, you can configure a form to add that information.
Set up the form you want to show to the user.
ACCOUNT_SIGNUP_FORM_CLASS = 'project.forms.MyUserForm'