fix: compat GLPI 11.0.4 — remove macro csrfField do form de config (1.5.1)
- config_form usava fields.csrfField() (inexistente no 11.0.4) -> erro fatal - token CSRF agora via csrf_token_value (PHP); URL usa textField - compatível com 11.0.0+ Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
bb2ef47493
commit
1ea7af6435
4 changed files with 14 additions and 5 deletions
|
|
@ -4,6 +4,14 @@ Todas as mudanças relevantes deste plugin são documentadas aqui.
|
||||||
O formato segue [Keep a Changelog](https://keepachangelog.com/pt-BR/1.0.0/)
|
O formato segue [Keep a Changelog](https://keepachangelog.com/pt-BR/1.0.0/)
|
||||||
e o versionamento segue [SemVer](https://semver.org/lang/pt-BR/).
|
e o versionamento segue [SemVer](https://semver.org/lang/pt-BR/).
|
||||||
|
|
||||||
|
## [1.5.1]
|
||||||
|
|
||||||
|
### Corrigido
|
||||||
|
- Compatibilidade com GLPI 11.0.4: o formulário de configuração usava o macro
|
||||||
|
`fields.csrfField()` (só existe a partir de versões mais novas), causando
|
||||||
|
`Macro "csrfField" is not defined`. Agora o token CSRF é emitido via
|
||||||
|
`csrf_token_value` (PHP), e o campo de URL usa `textField` — compatível com 11.0.0+.
|
||||||
|
|
||||||
## [1.5.0]
|
## [1.5.0]
|
||||||
|
|
||||||
### Adicionado
|
### Adicionado
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,7 @@ class PluginRedmineConfig extends CommonDBTM {
|
||||||
|
|
||||||
\Glpi\Application\View\TemplateRenderer::getInstance()->display('@redmine/config_form.html.twig', [
|
\Glpi\Application\View\TemplateRenderer::getInstance()->display('@redmine/config_form.html.twig', [
|
||||||
'action_url' => Toolbox::getItemTypeFormURL(__CLASS__),
|
'action_url' => Toolbox::getItemTypeFormURL(__CLASS__),
|
||||||
|
'csrf_token_value' => Session::getNewCSRFToken(),
|
||||||
'redmine_url' => $config['redmine_url'] ?? '',
|
'redmine_url' => $config['redmine_url'] ?? '',
|
||||||
'has_key' => !empty($config['api_key']),
|
'has_key' => !empty($config['api_key']),
|
||||||
'has_metadata' => !empty($metadata['trackers']) || !empty($metadata['statuses']),
|
'has_metadata' => !empty($metadata['trackers']) || !empty($metadata['statuses']),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('PLUGIN_REDMINE_VERSION', '1.5.0');
|
define('PLUGIN_REDMINE_VERSION', '1.5.1');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the Mindplace License class if the autoloader has not run yet.
|
* Load the Mindplace License class if the autoloader has not run yet.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{% import 'components/form/fields_macros.html.twig' as fields %}
|
{% import 'components/form/fields_macros.html.twig' as fields %}
|
||||||
|
|
||||||
<form method="post" action="{{ action_url }}">
|
<form method="post" action="{{ action_url }}">
|
||||||
{{ fields.csrfField() }}
|
<input type="hidden" name="_glpi_csrf_token" value="{{ csrf_token_value }}">
|
||||||
<input type="hidden" name="id" value="1">
|
<input type="hidden" name="id" value="1">
|
||||||
|
|
||||||
{# --- Conexão --- #}
|
{# --- Conexão --- #}
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{ fields.urlField('redmine_url', redmine_url, __('URL do Redmine', 'redmine'), {
|
{{ fields.textField('redmine_url', redmine_url, __('URL do Redmine', 'redmine'), {
|
||||||
'helper': 'https://redmine.exemplo.com.br'
|
'helper': 'https://redmine.exemplo.com.br'
|
||||||
}) }}
|
}) }}
|
||||||
{{ fields.passwordField('api_key', '', __('Chave de API (Admin)', 'redmine'), {
|
{{ fields.passwordField('api_key', '', __('Chave de API (Admin)', 'redmine'), {
|
||||||
|
|
@ -108,7 +108,7 @@
|
||||||
<td>{{ m.redmine_name }}</td>
|
<td>{{ m.redmine_name }}</td>
|
||||||
<td class="text-end">
|
<td class="text-end">
|
||||||
<form method="post" action="{{ action_url }}" class="d-inline">
|
<form method="post" action="{{ action_url }}" class="d-inline">
|
||||||
{{ fields.csrfField() }}
|
<input type="hidden" name="_glpi_csrf_token" value="{{ csrf_token_value }}">
|
||||||
<input type="hidden" name="del_usermap" value="{{ m.id }}">
|
<input type="hidden" name="del_usermap" value="{{ m.id }}">
|
||||||
<button type="submit" class="btn btn-sm btn-outline-danger"><i class="ti ti-trash"></i></button>
|
<button type="submit" class="btn btn-sm btn-outline-danger"><i class="ti ti-trash"></i></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
@ -121,7 +121,7 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<form method="post" action="{{ action_url }}" class="mt-3">
|
<form method="post" action="{{ action_url }}" class="mt-3">
|
||||||
{{ fields.csrfField() }}
|
<input type="hidden" name="_glpi_csrf_token" value="{{ csrf_token_value }}">
|
||||||
<input type="hidden" name="add_usermap" value="1">
|
<input type="hidden" name="add_usermap" value="1">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{ fields.dropdownField('User', 'override_users_id', 0, __('Usuário GLPI', 'redmine'), {'display_emptychoice': true}) }}
|
{{ fields.dropdownField('User', 'override_users_id', 0, __('Usuário GLPI', 'redmine'), {'display_emptychoice': true}) }}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue