def login_view(request): if request.method == "POST": form = LoginForm(request.POST) if form.is_valid(): data = form.cleaned_data user = authenticate(request, username=data.get("username"), password=data.get("password")) if user: login(request, user) return HttpResponseRedirect(request.GET.get('next', reverse("homepage"))) form = LoginForm() return render(request, "generic_form.html", {"form" : form})
def loguserin(request): loginform = LoginForm() if request.method == 'POST': loginform = LoginForm(request.POST) if loginform.is_valid(): user = authenticate(username=request.POST["user_name"], password=request.POST["password"]) if user is not None: if user.is_active: login(request, user) return HttpResponseRedirect('/sharerecipes') categories = Category.objects.all().order_by("name") return render(request, "login.html", {"loginform": loginform, "categories":categories})
def loginview(request): if request.method == "POST": form = LoginForm(request.POST) if form.is_valid(): data = form.cleaned_data user = authenticate(request, username=data['username'], password=data['password']) if user: login(request, user) return HttpResponseRedirect(request.GET.get('next', '/')) form = LoginForm() return render(request, 'generic_form.html', {'form': form})
def loginview(request): if request.method == "POST": form = LoginForm(request.POST) if form.is_valid(): data = form.cleaned_data user = authenticate(request, username=data["username"], password=data["password"]) if user: login(request, user) return HttpResponseRedirect( request.GET.get('next', reverse('homepage'))) form = LoginForm() return render(request, 'author_form.html', {'form': form})
def loguserin(request): loginform = LoginForm() if request.method == 'POST': loginform = LoginForm(request.POST) if loginform.is_valid(): user = authenticate(username=request.POST["user_name"], password=request.POST["password"]) if user is not None: if user.is_active: login(request, user) return HttpResponseRedirect('/sharerecipes') categories = Category.objects.all().order_by("name") return render(request, "login.html", { "loginform": loginform, "categories": categories })