inverse-inc / packetfence

PacketFence is a fully supported, trusted, Free and Open Source network access control (NAC) solution. Boasting an impressive feature set including a captive-portal for registration and remediation, centralized wired and wireless management, powerful BYOD management options, 802.1X support, layer-2 isolation of problematic devices; PacketFence can be used to effectively secure networks small to very large heterogeneous networks.
https://packetfence.org
GNU General Public License v2.0
1.37k stars 287 forks source link

ZEN V12 - Captive portal displaying latin characters incorrectly as ASCII <only on central DIV> #7281

Closed grazzianos closed 2 years ago

grazzianos commented 2 years ago

I'm testing the ZEN v12 image, manually migrating some configurations for homologation. When I tested captive portal, a strange behavior occourred: the central DIV was displaying latin chatacters incorrectly, but in other parts of the page, the characters was displayed correctly.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Configuration' > ' Advanced Access Configuration' > Portal Modules;
  2. Create a new root module;
  3. Create a new 'Message' module;
  4. Insert this message in the right field:
<h3>Você não tem permissão para acessar esta rede local!</h3>
<br>
Para obter acesso, clique em continuar e entre com as credenciais autorizadas para autenticação. 
<br><br>
<p><i>Ao validar este método, os registros de sua navegação serão armazenados, podendo ser utilizados como material probatório para eventuais sanções, de acordo com nossa Política de Usabilidade.</i></p>
  1. Go to 'Policies and Access Control' > 'Connection Profiles';
  2. Edit 'default' profile, setting as 'Root Portal Module' the module created on step 2;
  3. Click on preview;
  4. See the error.

Expected behavior See the message module correctly displaying Latin characters. Apparently, the system changed the code format of the inserted text to ASCII.

Desktop:

Additional context I saw a similar closed issue (https://github.com/inverse-inc/packetfence/issues/3952), but in my case, occurred only on central DIV of the captive page. Someone with the same issue? Can someone help me?

I need to implement v12 soon in my office.

Screenshots Bellow, the images of my issue:

Captura de tela 2022-10-16 200216

Captura de tela 2022-10-16 200233

nqb commented 2 years ago

Hello @grazzianos,

You didn't use your template to open issues. Please update your issue description. We need steps in order to replicate issue.

grazzianos commented 2 years ago

Hello @nqb.

Sorry, when I clicked on new issue, the template didn't appear to me. Issue properly updated.

nqb commented 2 years ago

Hello @grazzianos,

Thanks ! I'm able to replicate issue.

Issues I noticed:

Important: If I add UTF8 characters inside aup_text.html, they appear correctly.

Conf files to replicate:

#profiles.conf
[..]
[french_sms_profile_source_on_portal]
advanced_filter=
locale=
filter=connection_type:Inline
sources=french_sms

[french_sms_profile_with_portal_module]
filter=connection_type:Inline
root_module=french_sms_root_module
locale=
advanced_filter=

#portal_modules.conf
[..]
[french_sms_root_module]
description=french_sms_root_module
modules=choice
type=Root

[french_sms_auth_portal_module]
pid_field=telephone
signup_template=signin.html
with_aup=1
fields_to_save=
actions=
aup_template=aup_text.html
description=french_sms_auth_portal_module_description
type=Authentication::SMS
custom_fields=
source_id=french_sms

[null_authentication_module]
custom_fields=
source_id=null
type=Authentication::Null
description=null_authentication_module_desc
aup_template=aup_text.html
actions=
fields_to_save=
with_aup=1
signup_template=signin.html

[choice]
modules=french_sms_auth_portal_module,null_authentication_module,french_sms_auth_portal_module_copy
show_first_module_on_default=disabled
template=content-with-choice.html
type=Choice
description=choice_desc
actions=

[french_sms_auth_portal_module_copy]
description=France Télé auth module description
aup_template=aup_text.html
actions=
source_id=french_sms
custom_fields=
type=Authentication::SMS
signup_template=signin.html
pid_field=telephone
fields_to_save=
with_aup=1

#authentication.conf
[..]
[french_sms]
set_access_durations_action=
local_account_logins=0
type=SMS
description=France Télé SMS source description
pin_code_length=6
message=PIN: $pin
password_length=8
hash_passwords=bcrypt
sms_carriers=
sms_activation_timeout=10m
local_account_expiration=0s
create_local_account=no

[null]
description=Null Source
type=Null
email_required=no
dynamic_routing_module=AuthModule

[null rule catchall]
description=catchall
class=authentication
match=all
action0=set_role=guest
action1=set_access_duration=1D
status=enabled

@jrouzierinverse, I think these issues are related to #7106. Could you look into this ?

grazzianos commented 2 years ago

Hello @nqb,

Thanks for the quickly appreciation.

nqb commented 2 years ago

Fix has been backported to maintenance/12.0