django-graphql-auth icon indicating copy to clipboard operation
django-graphql-auth copied to clipboard

Manual creation password encryption

Open Loschcode opened this issue 4 years ago • 1 comments

I'm trying to create a user manually without passing through the register mutation. Something like this:

      user = CustomUser.objects.create(
        username=response['email'],
        first_name=response['first_name'],
        last_name=response['last_name'],
        mobile=response['mobile'],
        email=response['email'],
        password=password,
      )

But the password passes through some encryption I can't reproduce here. I couldn't find it in the doc, or anywhere on the Internet, and can't find it in the source code. How does that work? How can I encrypt it correctly?

Loschcode avatar Jan 11 '21 19:01 Loschcode

I'm not sure this is the right place to answer it, it looks like more of Django question than graphql to me. Giving a proper answer without knowing how CustomUser is implemented is not really possible but you may want to check https://docs.djangoproject.com/en/3.1/ref/contrib/auth/#django.contrib.auth.models.UserManager.create_user and https://docs.djangoproject.com/en/3.1/topics/auth/passwords/

ulgens avatar Jan 11 '21 23:01 ulgens