Ejemplo n.º 1
0
def logout(request):
    try:
        lo(request)
    except:
        pass
    resp = redirect('accounts:login')  # login url
    return resp
Ejemplo n.º 2
0
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')
Ejemplo n.º 3
0
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')
Ejemplo n.º 4
0
 def get(self, request):
     lo(request)
     return redirect(reverse("user:login"))
Ejemplo n.º 5
0
 def get(self, request):
     user = request.user
     if user:
         lo(request)
     return render(request, "user/login.html")
Ejemplo n.º 6
0
def logout(request):
    lo(request)
    return redirect("/index")
Ejemplo n.º 7
0
def logout(request):
    lo(request)
    return redirect('/')
Ejemplo n.º 8
0
def logout(request):
    lo(request)
    messages.success(request, 'sucessifully logout')
    return redirect('home')
Ejemplo n.º 9
0
def logout(request):
    lo(request)
    return HttpResponseRedirect("/")