Skip to content

Commit

Permalink
fix: authmail connection test form
Browse files Browse the repository at this point in the history
  • Loading branch information
flegastelois committed Nov 28, 2024
1 parent 167d376 commit 41fa0c7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
10 changes: 6 additions & 4 deletions src/AuthMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,11 @@ public function showFormTestMail()

if ($this->getFromDB($ID)) {
$twig_params = [
'title' => __('Test connection to email server'),
'login' => __('Login'),
'password' => __('Password'),
'test' => _x('button', 'Test'),
'title' => __('Test connection to email server'),
'login' => __('Login'),
'password' => __('Password'),
'test' => _x('button', 'Test'),
'connect_string' => $this->fields['connect_string'] ?? ''
];
// language=Twig
echo TemplateRenderer::getInstance()->renderFromStringTemplate(<<<TWIG
Expand All @@ -232,6 +233,7 @@ public function showFormTestMail()
autocomplete: 'password'
}
}) }}
{{ fields.hiddenField('imap_string', connect_string) }}
<div>
<input type="hidden" name="_glpi_csrf_token" value="{{ csrf_token() }}">
<button type="submit" name="test" class="btn btn-primary">{{ test }}</button>
Expand Down
2 changes: 1 addition & 1 deletion templates/pages/setup/authentication/mail.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
{% set connect_opts = call('Toolbox::parseMailServerConnectString', [item.fields['connect_string']]) %}
{{ include('pages/setup/mailcollector/server_config_fields.html.twig', {
'connect_opts': connect_opts,
'host': item.fields['connect_string']
'connect_string': item.fields['connect_string']
}) }}

{{ fields.smallTitle(__('Email options')) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#}

{% import 'components/form/fields_macros.html.twig' as fields %}
{% import 'components/form/basic_inputs_macros.html.twig' as inputs %}

{{ fields.textField(
'mail_server',
Expand Down Expand Up @@ -119,9 +118,8 @@
connection_options_fields,
__('Connection options')
) }}
{{ inputs.hidden('imap_string', host) }}
{% if host is not empty %}
{{ fields.htmlField('', host, __('Connection string'), {
{% if connect_string is not empty %}
{{ fields.htmlField('', connect_string, __('Connection string'), {
add_field_class: 'fw-bold'
}) }}
{% endif %}
2 changes: 1 addition & 1 deletion templates/pages/setup/mailcollector/setup_form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

{{ include('pages/setup/mailcollector/server_config_fields.html.twig', {
'connect_opts': connect_opts,
'host': host
'connect_string': host
}) }}

{{ fields.smallTitle(__('Authentication')) }}
Expand Down

0 comments on commit 41fa0c7

Please sign in to comment.