0
    state = "Please log in below"
    if request.POST:
       username = request.POST.get('username')
       password = request.POST.get('password')
       user = authenticate(username=username, password=password)
       if user is not None:
               if user.is_active:
                   login(request, user)
                   state = "You're successfully logged in!"
       else:
            state = "Your account is not active, please log back in."
    else:
        state = "Your username and/or password were incorrect."
return render(request, template_name, {'state': state})

如果我输入了错误的用户名或密码,它会捕获它。但是当我输入正确的凭据时,它会给我“超出最大递归深度”。

4

0 回答 0