Files
FOSSBilling/src/modules/Client/html_admin/mod_client_settings.html.twig
T
Belle Aerni 8821d50cff Created a CSRF token system (#526)
* Implement a basic CSRF token system

* Update forms for all modules

* Added to the theme forms

* Create a config option for CSRF prevention

* Slightly rework the filter

* Let's actually use a global var

* Added the token to API hrefs

* Fixup

* Remove old reference

* Added the token to the installer twig globals

* The token isn't actually needed in the installer

* Fix client searching

* Whoops - those need quotes
2022-12-06 18:47:14 +01:00

123 lines
8.4 KiB
Twig

{% extends request.ajax ? 'layout_blank.html.twig' : 'layout_default.html.twig' %}
{% import 'macro_functions.html.twig' as mf %}
{% block meta_title %}{{ 'Client settings'|trans }}{% endblock %}
{% set active_menu = 'system' %}
{% block breadcrumbs %}
<ul class="breadcrumb">
<li class="breadcrumb-item">
<a href="{{ '/'|alink }}">
<svg class="icon">
<use xlink:href="#home" />
</svg>
</a>
</li>
<li class="breadcrumb-item">
<a href="{{ 'system'|alink }}">{{ 'Settings'|trans }}</a>
</li>
<li class="breadcrumb-item active" aria-current="page">{{ 'Client settings'|trans }}</li>
</ul>
{% endblock %}
{% block content %}
{% set params = admin.extension_config_get({ 'ext': 'mod_client' }) %}
<div class="card">
<form method="post" action="{{ 'api/admin/extension/config_save'|link }}" class="api-form" data-api-msg="{{ 'Configuration updated'|trans }}">
<input type="hidden" name="CSRFToken" value="{{ CSRFToken }}"/>
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active" href="#tab-index" data-bs-toggle="tab">{{ 'General'|trans }}</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" href="#tab-custom-fields" data-bs-toggle="tab">{{ 'Custom Fields'|trans }}</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade show active" id="tab-index" role="tabpanel">
<div class="card-body">
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Allow new signups'|trans }}</label>
<div class="col">
<input type="radio" name="allow_signup" value="1"{% if params.allow_signup %} checked="checked"{% endif %}/><label>{{ 'Yes'|trans }}</label>
<input type="radio" name="allow_signup" value="0"{% if not params.allow_signup %} checked="checked"{% endif %} /><label>{{ 'No'|trans }}</label>
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Require email confirmation'|trans }}</label>
<div class="col">
<input type="radio" name="require_email_confirmation" value="1"{% if params.require_email_confirmation %} checked="checked"{% endif %}/><label>{{ 'Yes'|trans }}</label>
<input type="radio" name="require_email_confirmation" value="0"{% if not params.require_email_confirmation %} checked="checked"{% endif %} /><label>{{ 'No'|trans }}</label>
<span class="formNote">{{ 'After enabling this feature, all existing users will have to confirm their emails if it was not done before'|trans }}.</span>
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Allow email change'|trans }}</label>
<div class="col">
<input type="radio" name="allow_change_email" value="1"{% if params.allow_change_email %} checked="checked"{% endif %}/><label>{{ 'Yes'|trans }}</label>
<input type="radio" name="allow_change_email" value="0"{% if not params.allow_change_email %} checked="checked"{% endif %} /><label>{{ 'No'|trans }}</label>
</div>
</div>
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{{ 'Required fields'|trans }}</label>
<div class="col">
<select class="form-select" name="required[]" multiple="multiple">
<optgroup label="General">
<option value="last_name" {% if 'last_name' in params.required %}selected{% endif %}>{{ 'Last Name'|trans }}</option>
<option value="company" {% if 'company' in params.required %}selected{% endif %}>{{ 'Company'|trans }}</option>
<option value="gender" {% if 'gender' in params.required %}selected{% endif %}>{{ 'Gender'|trans }}</option>
<option value="birthday" {% if 'birthday' in params.required %}selected{% endif %}>{{ 'Birthday'|trans }}</option>
</optgroup>
<optgroup label="Address">
<option value="country" {% if 'country' in params.required %}selected{% endif %}>{{ 'Country'|trans }}</option>
<option value="city" {% if 'city' in params.required %}selected{% endif %}>{{ 'City'|trans }}</option>
<option value="state" {% if 'state' in params.required %}selected{% endif %}>{{ 'State'|trans }}</option>
<option value="address_1" {% if 'address_1' in params.required %}selected{% endif %}>{{ 'Address Line 1'|trans }}</option>
<option value="address_2" {% if 'address_2' in params.required %}selected{% endif %}>{{ 'Address Line 2'|trans }}</option>
<option value="postcode" {% if 'last_name' in params.required %}selected{% endif %}>{{ 'Post code'|trans }}</option>
<option value="phone" {% if 'phone' in params.required %}selected{% endif %}>{{ 'Phone'|trans }}</option>
</optgroup>
</select>
</div>
</div>
<input type="submit" value="{{ 'Update'|trans }}" class="btn btn-primary w-100">
</div>
</div>
<div class="tab-pane fade" id="tab-custom-fields" role="tabpanel">
<div class="card-body">
{% for i in 1..10 %}
{% set field_name = 'custom_' ~ i %}
{% set custom_field = attribute(params.custom_fields, field_name) %}
<div class="mb-3 row">
<label class="form-label col-3 col-form-label">{% if custom_field.title is not empty %} {{ custom_field.title }} ({{ 'Custom_'|trans }}{{ i }}) {% else %}{{ 'Custom_'|trans }}{{ i }}{% endif %}</label>
<div class="col">
<div class="form-check">
<input class="form-check-input" id="checkboxActive-{{ field_name }}" type="checkbox" name="custom_fields[{{ field_name }}][active]" value="1"{% if custom_field.active %} checked{% endif %}>
<label class="form-check-label" for="checkboxActive-{{ field_name }}">{{ 'Active'|trans }}</label>
</div>
<div class="form-check">
<input class="form-check-input" id="checkboxRequired-{{ field_name }}" type="checkbox" name="custom_fields[{{ field_name }}][required]" value="1"{% if custom_field.required %} checked{% endif %}>
<label class="form-check-label" for="checkboxRequired-{{ field_name }}">{{ 'Required'|trans }}</label>
</div>
<input class="form-control" type="text" placeholder="{{ 'Field title'|trans }}" name="custom_fields[{{ field_name }}][title]" value="{{ custom_field.title }}">
</div>
</div>
<hr>
{% endfor %}
<input type="submit" value="{{ 'Update profile'|trans }}" class="btn btn-primary w-100">
</div>
</div>
</div>
<input type="hidden" name="ext" value="mod_client">
</form>
</div>
{% endblock %}