def logout(request): try: lo(request) except: pass resp = redirect('accounts:login') # login url return resp
def login(request): if request.method == "POST": username = request.POST["username"] password = request.POST["password"] user = authenticate(request, username=username, password=password) if user is not None: lo(request, user) return redirect('/home') else: messages.info(request, "invalid credetial") return redirect('/login') else: return render(request, 'registerApp/login.html')
def login(request): if request.method == "POST": a = request.POST["username"] b = request.POST["pass"] user = authenticate(request , username = a, password = b) next_ = request.GET.get('next',settings.LOGIN_REDIRECT_URL) next_post = request.POST.get('next') redirect_path = next_ or next_post or None print(user) if user is not None: lo(request, user) return HttpResponseRedirect(request.GET.get('next',settings.LOGIN_REDIRECT_URL)) elif User.obb.filter( username = a ).exists(): messages.info(request,'Passward not matched') return redirect('/') else: messages.info(request,'Username and Passward not matched') return redirect('/') else: return render(request,'index.html')
def get(self, request): lo(request) return redirect(reverse("user:login"))
def get(self, request): user = request.user if user: lo(request) return render(request, "user/login.html")
def logout(request): lo(request) return redirect("/index")
def logout(request): lo(request) return redirect('/')
def logout(request): lo(request) messages.success(request, 'sucessifully logout') return redirect('home')
def logout(request): lo(request) return HttpResponseRedirect("/")