Пример #1
0
def _approval_terms_post(request, template_name, terms, extra_context):
    next = restrict_next(request.POST.get('next'),
                         domain=settings.COOKIE_DOMAIN)
    if not next:
        next = reverse('index')
    form = SignApprovalTermsForm(request.POST, instance=request.user)
    if not form.is_valid():
        return render_response(template_name,
                               terms=terms,
                               approval_terms_form=form,
                               context_instance=get_context(
                                   request, extra_context))
    user = form.save()
    return HttpResponseRedirect(next)
Пример #2
0
def _approval_terms_post(request, template_name, terms, extra_context):
    next = restrict_next(
        request.POST.get('next'),
        domain=settings.COOKIE_DOMAIN
    )
    if not next:
        next = reverse('index')
    form = SignApprovalTermsForm(request.POST, instance=request.user)
    if not form.is_valid():
        return render_response(template_name,
                               terms=terms,
                               approval_terms_form=form,
                               context_instance=get_context(request,
                                                            extra_context))
    user = form.save()
    return HttpResponseRedirect(next)
Пример #3
0
        f = open(terms_record.location, 'r')
    except IOError:
        messages.error(request, _(astakos_messages.GENERIC_ERROR))
        return render_response(template_name,
                               context_instance=get_context(
                                   request, extra_context))

    terms = f.read()

    if request.method == 'POST':
        return _approval_terms_post(request, template_name, terms,
                                    extra_context)
    else:
        form = None
        if request.user.is_authenticated() and not request.user.signed_terms:
            form = SignApprovalTermsForm(instance=request.user)
        return render_response(template_name,
                               terms=terms,
                               approval_terms_form=form,
                               context_instance=get_context(
                                   request, extra_context))


@require_http_methods(["GET", "POST"])
@cookie_fix
@transaction.commit_on_success
def request_change_email(
        request,
        email_to_new_template_name='registration/email_change_email_new_email.txt',
        form_template_name='registration/email_change_form.html',
        extra_context=None):
Пример #4
0
    try:
        f = open(term.location, 'r')
    except IOError:
        messages.error(request, _(astakos_messages.GENERIC_ERROR))
        return render_response(template_name,
                               context_instance=get_context(
                                   request, extra_context))

    terms = f.read()

    if request.method == 'POST':
        next = restrict_next(request.POST.get('next'),
                             domain=settings.COOKIE_DOMAIN)
        if not next:
            next = reverse('index')
        form = SignApprovalTermsForm(request.POST, instance=request.user)
        if not form.is_valid():
            return render_response(template_name,
                                   terms=terms,
                                   approval_terms_form=form,
                                   context_instance=get_context(
                                       request, extra_context))
        user = form.save()
        return HttpResponseRedirect(next)
    else:
        form = None
        if request.user.is_authenticated() and not request.user.signed_terms:
            form = SignApprovalTermsForm(instance=request.user)
        return render_response(template_name,
                               terms=terms,
                               approval_terms_form=form,
Пример #5
0
        f = open(terms_record.location, 'r')
    except IOError:
        messages.error(request, _(astakos_messages.GENERIC_ERROR))
        return render_response(
            template_name, context_instance=get_context(request,
                                                        extra_context))

    terms = f.read()

    if request.method == 'POST':
        return _approval_terms_post(request, template_name, terms,
                                    extra_context)
    else:
        form = None
        if request.user.is_authenticated() and not request.user.signed_terms:
            form = SignApprovalTermsForm(instance=request.user)
        return render_response(template_name,
                               terms=terms,
                               approval_terms_form=form,
                               context_instance=get_context(request,
                                                            extra_context))


@require_http_methods(["GET", "POST"])
@cookie_fix
@transaction.commit_on_success
def change_email(request, activation_key=None,
                 email_template_name='registration/email_change_email.txt',
                 form_template_name='registration/email_change_form.html',
                 confirm_template_name='registration/email_change_done.html',
                 extra_context=None):