# Customer Portal applications

> For the complete documentation index, see [llms.txt](https://doc.ibexa.co/en/saas/llms.txt).

Customization of an approval process for new companies applications.

New business customers can apply for a company account. Applications go through the approval process in the back office where they can be accepted, rejected or put on hold. If they're accepted, the business partner receives an invitation link to the Customer Portal, where they can set up their team and manage their account.

For more information on company self-registration, see [user guide documentation](https://doc.ibexa.co/projects/userguide/en/6.0/customer_management/company_self_registration/). If provided options are too limited, you can customize an approval process by yourself.

## Roles and policies

Any user can become application approver, as long as they have the `Company Application/Workflow` policy assigned to their role. There, you can define between which states the user may move applications. For example, the assistant can put new applications on hold, or reject them, and only the manager can accept them.

![Company Application policy](https://doc.ibexa.co/en/saas/customer_management/img/cp_company_application_policy.png)

## Customer Portal application configuration

Below, you can find possible configurations for Customer Portal applications.

### Reasons for rejecting application

To change or add reasons for not accepting Corporate Portal application go to `vendor/ibexa/corporate-account/src/bundle/Resources/config/default_settings.yaml`.

```yaml
parameters:
    ibexa.site_access.config.default.corporate_accounts.reasons:
        reject: [Malicious intent / Spam]
        on_hold: [Verification in progress]
```

### Timeout

Registration form locks for 5 minutes after unsuccessful registration, if the user, for example, tried to use an email address that already exists in a Customer Portal clients database. To change that duration, go to `config/packages/ibexa.yaml`.

```yaml
framework:
    rate_limiter:
        corporate_account_application:
            policy: 'fixed_window'
            limit: 1
            interval: '5 minutes'
            lock_factory: 'lock.corporate_account_application.factory'
```

## Customization of an approval process

In this procedure, you add a new status to the approval process of business account application.

### Add new status

First, under the `ibexa.system.<scope>.corporate_accounts.application.states` add a `verify` status to the [configuration](https://doc.ibexa.co/en/saas/administration/configuration/configuration/#configuration-files):

```yaml
ibexa:
    system:
        default:
            corporate_accounts:
                application:
                    states: [ 'new', 'accept', 'on_hold', 'reject', 'verify' ]
```

### Add form template

To be able to see the changes you need to add a new template `templates/themes/admin/corporate_account/application/details.html.twig`.

```html+twig
{% extends "@IbexaCorporateAccount/themes/admin/corporate_account/application/details.html.twig" %}

{% block content %}
    {{ form_start(verify_form, { action: path('ibexa.corporate_account.application.workflow.state', {
        state: 'verify',
        applicationId: application.id,
    }), method: 'POST'}) }}
    {{ form_row(verify_form.notes) }}

    <div class="ibexa-ca-application-workflow-extra-actions__btns">
        {{ form_widget(verify_form.verify, { attr: {
            class: 'ibexa-btn ibexa-btn--primary ibexa-ca-application-workflow-extra-actions__btn',
        }}) }}
    </div>
    {{ form_end(verify_form) }}

    {{ parent() }}
{% endblock %}
```

It overrides the default view and adds a **Verify** button to the review view. To check the progress, go to **Members** -> **Applications**. Select one application from the list and inspect application review view for a new button.

![Verify button](https://doc.ibexa.co/en/saas/customer_management/img/cp_new_status.png)
