def logout(request): # request.user.user_permissions.clear() # 删除权限,这行代码会对数据表进行操作 print(request.user.user_permissions.values()) Logout(request) print("logout.....") print(request.user.user_permissions.values()) return redirect('/')
def logout(request): if request.user.is_authenticated: del request.session['username'] Logout(request) return redirect('/customapp/login') else: return HttpResponse("You have already logout")
def logout(request): """ logs out the user :param request: Request object from client :return: index page """ Logout(request) return HttpResponseRedirect("/")
def login(request): if request.user.is_authenticated: Logout(request) if request.method == 'POST': form = UserLogInForm(request.POST) if form.is_valid(): username = form.cleaned_data.get('username') password = form.cleaned_data.get('password') remember = form.cleaned_data.get('remember') user = authenticate(request, username=username, password=password) if user: Login(request, user) if not remember: request.session.set_expiry(0) # else: # request.session.set_expiry(60*60*24*2) return redirect('home') else: messages.error(request, 'Wrong Username or Password') else: form = UserLogInForm() return render(request, 'users_app/log_in.html', {'form': form})
def logout(request): Logout(request) return HttpResponseRedirect("/login/")
def logout(request): Logout(request) return redirect('/')
def logout(request): if request.user.is_authenticated: Logout(request) messages.success(request, f'Successfuly logged out.') return render(request, 'main_app/home.html')
def logout(request): Logout(request) return redirect(HOME_LOGOUT)
def logout(request): Logout(request) return HttpResponseRedirect(reverse('microblog:index'))
def logout(request): Logout(request) return render(request, "users/login.html", {"message": "Logged out"})
def logout(request): Logout(request) user = request.session.get('user', None) if user is not None: del request.session['user'] return redirect('home')
def logout(request): Logout(request) form = LoginForm() return redirect('login')
def logout(request): print(request.session['name']) Logout(request) return HttpResponseRedirect('/')
def logout(request): Logout(request) return HttpResponseRedirect('/')
def post(self, request): Logout(request) return Response({"success": "logout"}, status=200)
def logout(request): Logout(request) messages.success(request, '¡Nos vemos pronto!') return HttpResponseRedirect('/')
def logout(req): Logout(req) return redirect(reverse('App:mine'))