示例#1
0
def logout(request, *args, **kwargs):
    if request.session.get('unsafe_logout'):
        return render(request, 'unsafe_logout.html')
    else:
        kwargs['next_page'] = request.GET.get(
            'next', kwargs.get('next_page', settings.LOGOUT_URL))
        return dj_logout(request, *args, **kwargs)
示例#2
0
def logout(request, *args, **kwargs):
    if request.session.get('unsafe_logout'):
        return render_to_response('unsafe_logout.html',
                                  {},
                                  context_instance=RequestContext(request))
    else:
        kwargs['next_page'] = request.GET.get('next', kwargs.get('next_page', settings.LOGOUT_URL))
        return dj_logout(request, *args, **kwargs)
示例#3
0
def logout(request, *args, **kwargs):
    if request.session.get('unsafe_logout'):
        return render_to_response('unsafe_logout.html', {},
                                  context_instance=RequestContext(request))
    else:
        kwargs['next_page'] = request.GET.get(
            'next', kwargs.get('next_page', settings.LOGOUT_URL))
        return dj_logout(request, *args, **kwargs)
示例#4
0
def logout(request):
    if request.method == "POST":
        form = LogoutForm(request.POST)
        if form.is_valid():
            create_audit_event(
                EVENT_TYPES.AUTHORISATION,
                ENDPOINT.UI,
                request,
                None,
                description=(
                    "Logged out %s." %
                    ("admin" if request.user.is_superuser else "user")),
            )
            dj_logout(request)
            return HttpResponse(status=204)
        return HttpResponseBadRequest(json.dumps(form.errors),
                                      content_type="application/json")
    return HttpResponseNotAllowed([request.method])
示例#5
0
def logout(request):
    if request.method == 'POST':
        form = LogoutForm(request.POST)
        if form.is_valid():
            return dj_logout(request, next_page=reverse('login'))
    else:
        form = LogoutForm()

    return render(request, 'maasserver/logout_confirm.html', {'form': form})
示例#6
0
文件: account.py 项目: zeronewb/maas
def logout(request):
    if request.method == 'POST':
        form = LogoutForm(request.POST)
        if form.is_valid():
            create_audit_event(
                EVENT_TYPES.AUTHORISATION,
                ENDPOINT.UI,
                request,
                None,
                description=(
                    "%s" % ('Admin' if request.user.is_superuser else 'User') +
                    " '%(username)s' logged out."))
            return dj_logout(request, next_page=reverse('login'))
    else:
        form = LogoutForm()

    return render(request, 'maasserver/logout_confirm.html', {'form': form})
示例#7
0
def logout(request):
    if request.method == "POST":
        form = LogoutForm(request.POST)
        if form.is_valid():
            create_audit_event(
                EVENT_TYPES.AUTHORISATION,
                ENDPOINT.UI,
                request,
                None,
                description=(
                    "Logged out %s."
                    % ("admin" if request.user.is_superuser else "user")
                ),
            )
            return dj_logout(request, next_page=reverse("login"))
    else:
        form = LogoutForm()

    return render(request, "maasserver/logout_confirm.html", {"form": form})
示例#8
0
def logout(request):
    dj_logout(request)
    return redirect(reverse_lazy('index'))
示例#9
0
文件: account.py 项目: cloudbase/maas
def logout(request):
    messages.info(request, "You have been logged out.")
    return dj_logout(request, next_page=reverse('login'))
示例#10
0
文件: account.py 项目: cloudbase/maas
def logout(request):
    messages.info(request, "You have been logged out.")
    return dj_logout(request, next_page=reverse('login'))
示例#11
0
def logout(request, *args, **kwargs):
    if request.session.get("unsafe_logout"):
        return render_to_response("unsafe_logout.html", {}, context_instance=RequestContext(request))
    else:
        kwargs["next_page"] = request.GET.get("next", kwargs.get("next_page", settings.LOGOUT_URL))
        return dj_logout(request, *args, **kwargs)