Beispiel #1
0
def submit_address():
    if _session_invalid(['title']):
        return redirect('/registration/about-you-personal')

    address_type = collect_address_type(request.form)
    form = _add_address_type_validators(address_type)

    if form.is_valid():
        populate_session(address_type)
        dps_session.commit()
        return redirect('/registration/address-details-personal')
    else:
        return render_template('app/registration/address-type-personal.html',
                               error_title="There are errors on this page",
                               fields=form.validate())
def submit_org_type():
    if _session_invalid(['title']):
        return redirect('/registration/about-you-uk-organisation')

    org_type = collect_organisation_type(request.form)
    form = _add_org_type_validators(org_type)

    if form.is_valid():
        populate_session(org_type, prefix='uk_org_')
        dps_session.commit()

        if org_type.type == 'Company':
            return redirect('/registration/company-details')
        elif org_type.type == 'Charity':
            return redirect('/registration/charity-details')
        else:
            return redirect('/registration/about-your-organisation-uk')

    else:
        return render_template('app/registration/org_uk_type.html',
                               error_title="There are errors on this page",
                               fields=form.validate())
Beispiel #3
0
def submit_address_uk():
    if _session_invalid(['uk_resident']):
        return redirect('/registration/address-type-personal')

    address_info = collect_address(request.form)
    form = _add_address_validators(address_info)

    if form.is_valid():
        session = populate_session(address_info)
        dps_session.commit()
        if 'changing_answers' in session['registration']:
            return redirect('/registration/check-your-answers-personal')
        return redirect('/registration/research')
    else:
        return render_template(
            'app/registration/address-details-personal.html',
            error_title="There are errors on this page",
            fields=form.validate())
def submit_personal_info():
    if _session_invalid('user_type'):
        return redirect('/registration')

    personal_info = collect_personal_info(request.form, 'org')

    form = add_personal_info_validators(personal_info, 'org')

    if form.is_valid():
        session = populate_session(personal_info)
        dps_session.commit()
        if 'changing_answers' in session['registration']:
            return redirect('/registration/check-your-answers-uk-organisation')
        return redirect('/registration/organisation-type')
    else:
        return render_template('app/registration/personal_information.html',
                               error_title="There are errors on this page",
                               route='about-you-uk-organisation',
                               fields=form.validate())
Beispiel #5
0
def submit_org_address():
    if _session_invalid(['overseas_org_country_incorp']):
        return redirect('/registration/about-your-organisation-overseas')

    org_info = collect_overseas_org_address(request.form)

    form = add_org_address_validators(org_info, 'overseas')

    if form.is_valid():
        session = populate_session(org_info, prefix='overseas_org_')
        dps_session.commit()
        if 'changing_answers' in session['registration']:
            return redirect(
                '/registration/check-your-answers-overseas-organisation')
        return redirect('/registration/research')
    else:
        return render_template('app/registration/org_address_overseas.html',
                               error_title="There are errors on this page",
                               fields=form.validate())
def submit_org_details():
    if _session_invalid(['uk_org_type']):
        return redirect('/registration/about-you-uk-organisation')

    company_details = collect_company_details(request.form)
    form = add_company_details_validators(company_details)

    if form.is_valid():
        session = populate_session(company_details, prefix='uk_org_')
        dps_session.commit()

        if 'changing_answers' in session['registration']:
            return redirect('/registration/check-your-answers-uk-organisation')

        return redirect('/registration/about-your-organisation-uk')

    else:
        return render_template('app/registration/company_details.html',
                               error_title="There are errors on this page",
                               fields=form.validate())
Beispiel #7
0
def submit_personal_info_page():
    if _session_invalid('user_type'):
        return redirect('/registration')

    personal_info = collect_personal_info(request.form, 'org')

    form = add_personal_info_validators(personal_info, 'org')

    if form.is_valid():
        session = populate_session(personal_info)
        dps_session.commit()

        # if user has HMLR email then they need to be directed to the uk org journey
        if is_hmlr_email(personal_info.email):
            return render_template(
                'app/registration/personal_information.html',
                error_title="There are errors on this page",
                route='about-you-overseas-organisation',
                fields={
                    'hmlr_email':
                    True,
                    'name':
                    'email',
                    'error':
                    'You cannot create a overseas organisation account using '
                    'a HM Land Registry email address',
                    'link':
                    '/registration/about-you-overseas-organisation-redirect',
                    'link_text':
                    'Create a UK organisation account'
                })
        else:
            if 'changing_answers' in session['registration']:
                return redirect(
                    '/registration/check-your-answers-overseas-organisation')
            return redirect('/registration/about-your-organisation-overseas')
    else:
        return render_template('app/registration/personal_information.html',
                               error_title="There are errors on this page",
                               route='about-you-overseas-organisation',
                               fields=form.validate())
Beispiel #8
0
def submit_contact_preferences():

    preferences = request.form.getlist('preferences')
    preference_info = collect_preferences(request.form)
    form = _add_preference_validators(preferences)

    if form.is_valid():
        session = populate_session(preference_info)
        session['registration']['contact_preferences'] = preferences
        session['registration']['changing_answers'] = True
        dps_session.commit()
        if request.form['user_type'] == 'overseas-organisation':
            return redirect('/registration/check-your-answers-overseas-organisation')
        elif request.form['user_type'] == 'uk-organisation':
            return redirect('/registration/check-your-answers-uk-organisation')
        else:
            return redirect('/registration/check-your-answers-personal')
    else:
        return render_template('app/registration/contact_preferences.html',
                               error_title="There are errors on this page",
                               fields=form.validate())
def submit_org_info():
    if _session_invalid(['uk_org_type']):
        return redirect('/registration/about-you-uk-organisation')

    org_info = collect_organisation_info(request.form)
    bypass = False
    if org_info.type == 'Charity' or org_info.type == 'Company':
        bypass = True
    form = add_org_info_validators(org_info, bypass)

    if form.is_valid():
        session = populate_session(org_info, prefix='uk_org_')
        dps_session.commit()

        if 'changing_answers' in session['registration']:
            return redirect('/registration/check-your-answers-uk-organisation')
        return redirect('/registration/research')
    else:
        return render_template('app/registration/org_information_uk.html',
                               error_title="There are errors on this page",
                               fields=form.validate())