Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Django custom authentication

def getLogin(request):
    if request.user.is_authenticated:
        return redirect('index')
    else:
        if request.method == "POST":
            user = request.POST.get('user')
            password = request.POST.get('pass')
            auth = authenticate(request, username=user, password=password)
            if auth is not None:
                login(request, auth)
                return redirect('index')
        return render(request, "login.html")
Source by naasir.netlify.app #
 
PREVIOUS NEXT
Tagged: #Django #custom #authentication
ADD COMMENT
Topic
Name
9+4 =