`authenticate` requires a positional argument (request) try userLogin = authenticate(request, username=username, password=password)
On Monday, April 24, 2023 at 5:51:45 PM UTC+1 oluwafemi damilola wrote: > userLogin = authenticate(request, username=username, password=password) > > On Mon, 24 Apr 2023 at 17:29, Opeoluwa Fatunmbi <[email protected]> > wrote: > >> >> Let me see your login.html >> >> >> >> >> >> >> On Mon, 24 Apr 2023 at 17:28, Lawal Tobiloba Samuel <[email protected]> >> wrote: >> >>> code here: >>> >>> def loginPage(request): >>> if request.method == "POST": >>> username = request.POST.get("username") >>> password = request.POST.get("password") >>> userLogin = authenticate(username=username, password=password) >>> if userLogin is not None: >>> login(request, userLogin) >>> return redirect("home") >>> else: >>> messages.info(request, "Username or Password incorrect.") >>> context = {"title": "User Login"} >>> return render(request, "account/login.html", context) >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> *Lawal Tobiloba Samuel* >>> >>> *Computer Engineer* >>> >>> *Front-end Developer* >>> >>> *IT Support Specialist* >>> >>> >>> >>> *Mobile: *+23480-6386-0181 >>> >>> +23481-2027-2000 >>> >>> *Email: *[email protected] >>> >>> [email protected] >>> >>> >>> >>> >>> >>> >>> >>> >>> On Mon, Apr 24, 2023 at 5:26 PM Lawal Tobiloba Samuel < >>> [email protected]> wrote: >>> >>>> Hi devs, >>>> I wrote code for user authentication and login but I am not quite sure >>>> of it. On the web interface it keeps displaying username or password >>>> incorrect (message set in views.py). >>>> >>>> -- >>> 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 view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/CAAscozW9b%2B-RBrnBtNJMMdz5w%3DOStYRuW1mf35kaTBBva%2Br6Lg%40mail.gmail.com >>> >>> <https://groups.google.com/d/msgid/django-users/CAAscozW9b%2B-RBrnBtNJMMdz5w%3DOStYRuW1mf35kaTBBva%2Br6Lg%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> 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 view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/CAKVBneJRaAxWhK2D7cqfS5i7YBOBWH50axCMZj6-c-NTDtMSbA%40mail.gmail.com >> >> <https://groups.google.com/d/msgid/django-users/CAKVBneJRaAxWhK2D7cqfS5i7YBOBWH50axCMZj6-c-NTDtMSbA%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2535b83b-785f-4ceb-9108-60b183771dfen%40googlegroups.com.

