On 24/04/2019 4:39 am, [email protected] wrote:
I am using authenticate function to authenticate user on login this is working properly but only allow superuser to login.

Are your other users active?


        def Login_View(request):

            if request.method == "POST":

                username = request.POST['username']

                password = request.POST['pwd']

                user =authenticate(request,username=username,
        password=password)

                if user is not None:

                    if user.is_active:

        login(request, user)

                        name = User.objects.get(username=request.user)

        request.session['username'] = username

        return redirect('/dashboard/',{'name':name.username})

                        # return
        render(request,'dashboard_app/index.html',{'name':name.username})

                    else:

         return render(request, 'login_app/index.html',
        {'error_message': 'Your account has been disabled'})

                else:

                    return render(request, 'login_app/index.html',
        {'error_message': 'Invalid login'})

            return render(request, 'login_app/index.html')

    kindly aolve my issue asap

--
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 [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/af4b7e96-eb62-4d56-988e-7eb4140f0a77%40googlegroups.com <https://groups.google.com/d/msgid/django-users/af4b7e96-eb62-4d56-988e-7eb4140f0a77%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dc989d82-dcd3-658d-0761-990eababec61%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

Reply via email to