0

I'm using django 1.9.7 and django-allauth to handle my user authentication.

I have a contact form that includes several Fields (including the users email address) which are saved as a model in the backend, from there I am using a ModelForm to display the fields. So far so good.

Now there should be a checkbox, which when checked should add two fields (password, password confirm) and instantly create an account with the email and password provided.

For this I would probably manually create a user object from the view that receives the contact information, but since its security relevant I'm wondering if there is an easy way to call a allauth method from python that creates the user (or even provides the form).

How would I go about this?

Update: So i found the adapter has a method called save_user() which would populate the information and save the new user.I could then add the two password fields to the form and just pass the form in there.

My issue that it would skip all the username and password cleaning, the email confirmation or the auto login after sign up.

Julian
  • 915
  • 8
  • 24

1 Answers1

0

You should be able to use the new_user() method in the default adapter. refer here https://github.com/pennersr/django-allauth/blob/master/allauth/socialaccount/adapter.py

pypypy
  • 1,075
  • 8
  • 18
  • Hmm, first of all i probably should use the local account adapter:https://github.com/pennersr/django-allauth/blob/master/allauth/account/adapter.py Secondly of you look at that one, it just creates a new user instance, without actually filling in data right? – Julian Nov 15 '16 at 18:26