Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: authmail connection test form #18410

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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