How to force a user logout in Django?

前端 未结 10 2145
粉色の甜心
粉色の甜心 2020-11-30 17:27

In my Django app under certain conditions I want to be able to force users to log out by a username. Not necessarily the current user who is logged in, but another user. So,

10条回答
  •  失恋的感觉
    2020-11-30 18:12

    Even I faced this issue. Few spammers from India keep posting about those Baba and Molvi for love solutions.

    What I did is at the time of posting just inserted this code:

    if request.user.is_active==False:
                return HttpResponse('You are banned on the site for spaming.')
    

提交回复
热议问题