problem with user autentication

27 views
Skip to first unread message

Luca Bertolotti

unread,
Apr 3, 2020, 5:20:44 PM4/3/20
to Django users
Hello i can't authenticate user

I have crete the user with:

def create_user(request

    us = request.POST['username']
    ml = request.POST['email']
    passw = request.POST['password']
    User.objects.create_user(us, ml, passw)

   return......................

I see the user in the database

than i need to autenticate for the login

def check_user(request):
    email = request.POST.get('email')
    username = request.POST.get('username')
    password = request.POST.get('password')
    user = authenticate(username=username, password=password, email=email)
    if user is not None:
        login(request, user)
        return redirect('aabb')
    else:
        return ..............

but i never get the user object, user and password are correct

Can you help me

ahmed elabbasy

unread,
Apr 3, 2020, 7:20:04 PM4/3/20
to Django users
u must include the save method

Motaz Hejaze

unread,
Apr 3, 2020, 8:35:06 PM4/3/20
to Django users
authenticate take only 2 parameters :
1 - username_field ( default : username , if you changed it to email you need to pass email )
2 - password



On Sat, Apr 4, 2020 at 1:19 AM ahmed elabbasy <ahmedel...@gmail.com> wrote:
u must include the save method

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ddc2ee9b-cb3a-4b6d-8c1e-2000b7e9097d%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages