Esempio n. 1
0
def users_check(request):
    form = UserSearchForm(request.GET if request.GET else None)

    user_list = None
    if form.is_valid():
        email = form.cleaned_data["email"]
        user_list = User.objects.filter(
            Q(email=email)
            | Q(social_auth__verifiedemail__email__iexact=email)
            | Q(username=email)).distinct()
        if user_list.count() != 1:
            return redirect_param(
                "manage-users",
                "?q={}".format(quote(form.cleaned_data["email"])))
        return redirect(user_list[0])
    return redirect("manage-users")
Esempio n. 2
0
def users_check(request):
    form = UserSearchForm(request.GET if request.GET else None)

    user_list = None
    if form.is_valid():
        email = form.cleaned_data["email"]
        user_list = User.objects.filter(
            Q(email=email)
            | Q(social_auth__verifiedemail__email__iexact=email)).distinct()

    return render(
        request,
        "manage/users_check.html",
        {
            "menu_items": MENU,
            "menu_page": "users",
            "form": form,
            "users": user_list,
        },
    )
Esempio n. 3
0
    def get_context_data(self, **kwargs):
        result = super().get_context_data(**kwargs)

        if self.request.method == "POST":
            invite_form = AdminInviteUserForm(self.request.POST)
            invite_form.is_valid()
        else:
            invite_form = AdminInviteUserForm()

        result["menu_items"] = MENU
        result["menu_page"] = "users"
        result["invite_form"] = invite_form
        result["search_form"] = UserSearchForm()
        return result