コード例 #1
0
ファイル: home.py プロジェクト: kagonlineteam/zulip
def accounts_accept_terms(request: HttpRequest) -> HttpResponse:
    assert request.user.is_authenticated

    if request.method == "POST":
        form = ToSForm(request.POST)
        if form.is_valid():
            assert settings.TERMS_OF_SERVICE_VERSION is not None
            do_change_tos_version(request.user,
                                  settings.TERMS_OF_SERVICE_VERSION)
            return redirect(home)
    else:
        form = ToSForm()

    context = {
        "form": form,
        "email": request.user.delivery_email,
        # Text displayed when updating TERMS_OF_SERVICE_VERSION.
        "terms_of_service_message": settings.TERMS_OF_SERVICE_MESSAGE,
        # HTML template used when agreeing to terms of service the
        # first time, e.g. after data import.
        "first_time_terms_of_service_message_template": None,
    }

    if (request.user.tos_version is None
            and settings.FIRST_TIME_TERMS_OF_SERVICE_TEMPLATE is not None):
        context[
            "first_time_terms_of_service_message_template"] = settings.FIRST_TIME_TERMS_OF_SERVICE_TEMPLATE

    return render(
        request,
        "zerver/accounts_accept_terms.html",
        context,
    )
コード例 #2
0
ファイル: home.py プロジェクト: santoshkumarpatro23/zulip
def accounts_accept_terms(request: HttpRequest) -> HttpResponse:
    assert request.user.is_authenticated

    if request.method == "POST":
        form = ToSForm(request.POST)
        if form.is_valid():
            do_change_tos_version(request.user, settings.TERMS_OF_SERVICE_VERSION)
            return redirect(home)
    else:
        form = ToSForm()

    email = request.user.delivery_email
    special_message_template = None
    if (
        request.user.tos_version is None
        and settings.FIRST_TIME_TERMS_OF_SERVICE_TEMPLATE is not None
    ):
        special_message_template = settings.FIRST_TIME_TERMS_OF_SERVICE_TEMPLATE
    return render(
        request,
        "zerver/accounts_accept_terms.html",
        context={
            "form": form,
            "email": email,
            "special_message_template": special_message_template,
        },
    )
コード例 #3
0
ファイル: __init__.py プロジェクト: dehnert/zulip
def accounts_accept_terms(request):
    # type: (HttpRequest) -> HttpResponse
    if request.method == "POST":
        form = ToSForm(request.POST)
        if form.is_valid():
            do_change_tos_version(request.user, settings.TOS_VERSION)
            return redirect(home)
    else:
        form = ToSForm()

    email = request.user.email
    special_message_template = None
    if request.user.tos_version is None and settings.FIRST_TIME_TOS_TEMPLATE is not None:
        special_message_template = 'zerver/' + settings.FIRST_TIME_TOS_TEMPLATE
    return render_to_response('zerver/accounts_accept_terms.html',
        {'form': form, 'email': email, 'special_message_template': special_message_template},
        request=request)
コード例 #4
0
ファイル: __init__.py プロジェクト: wtfcarlos/zulip
def accounts_accept_terms(request):
    # type: (HttpRequest) -> HttpResponse
    if request.method == "POST":
        form = ToSForm(request.POST)
        if form.is_valid():
            do_change_tos_version(request.user, settings.TOS_VERSION)
            return redirect(home)
    else:
        form = ToSForm()

    email = request.user.email
    special_message_template = None
    if request.user.tos_version is None and settings.FIRST_TIME_TOS_TEMPLATE is not None:
        special_message_template = 'zerver/' + settings.FIRST_TIME_TOS_TEMPLATE
    return render_to_response('zerver/accounts_accept_terms.html',
        {'form': form, 'email': email, 'special_message_template': special_message_template},
        request=request)