[FIX] auth_signup: escape double quotes in email from value

Steps to reproduce:

  - Install "Sales" module (for test purpose)
  - Change company name to `בונז " ור מונד` (notice the double quotes)
  - Go to "Settings > Users & Companies > Users"
  - Select any user and then click on "send an invitation email" button
  - Go to inbox and check the email

Issue:

  No email received (at least not in main inbox).

Cause:

  The email is not received in main inbox (Gmail or Outlook might flag
  them since email from is not well parsed) because the `email from`
  value is not escaped properly (by escaping the double quotes).

Solution:

  Instead of using the company name (that is not escaped) and email to
  build the `email from` value, use the company email_formatted value
  instead (and fallback on user mail if not available).

opw-3097910

closes odoo/odoo#114534

X-original-commit: 0c4cb5e3cc2758cb27e94ecbbcfaa734ba5a50eb
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
This commit is contained in:
Nasreddin Boulif (bon)
2023-03-07 11:11:51 +01:00
parent afe6f967cd
commit c2f89c7bbb
2 changed files with 4 additions and 4 deletions
@@ -6,7 +6,7 @@
<field name="name">Settings: User Reset Password</field>
<field name="model_id" ref="base.model_res_users"/>
<field name="subject">Password reset</field>
<field name="email_from">"{{ object.company_id.name }}" &lt;{{ (object.company_id.email or user.email) }}&gt;</field>
<field name="email_from">{{ (object.company_id.email_formatted or user.email_formatted) }}</field>
<field name="email_to">{{ object.email_formatted }}</field>
<field name="description">Sent to user who requested a password reset</field>
<field name="body_html" type="html">
@@ -102,7 +102,7 @@
<field name="name">Settings: New Portal Signup</field>
<field name="model_id" ref="base.model_res_users"/>
<field name="subject">{{ object.create_uid.name }} from {{ object.company_id.name }} invites you to connect to Odoo</field>
<field name="email_from">"{{ object.company_id.name }}" &lt;{{ (object.company_id.email or user.email) }}&gt;</field>
<field name="email_from">{{ (object.company_id.email_formatted or user.email_formatted) }}</field>
<field name="email_to">{{ object.email_formatted }}</field>
<field name="description">Sent to new user after you invited them</field>
<field name="body_html" type="html">
@@ -250,7 +250,7 @@
<field name="name">Settings: New User Invite</field>
<field name="model_id" ref="base.model_res_users"/>
<field name="subject">Welcome to {{ object.company_id.name }}!</field>
<field name="email_from">"{{ object.company_id.name }}" &lt;{{ (object.company_id.email or user.email) }}&gt;</field>
<field name="email_from">{{ (object.company_id.email_formatted or user.email_formatted) }}</field>
<field name="email_to">{{ object.email_formatted }}</field>
<field name="description">Sent to portal user who registered themselves</field>
<field name="body_html" type="html">
@@ -6,7 +6,7 @@
<field name="model_id" ref="base.model_res_users" />
<field name="subject">Your two-factor authentication code</field>
<field name="email_to">{{ object.email_formatted }}</field>
<field name="email_from">"{{ object.company_id.name }}" &lt;{{ (object.company_id.email or user.email) }}&gt;</field>
<field name="email_from">{{ (object.company_id.email_formatted or user.email_formatted) }}</field>
<field name="lang">{{ object.partner_id.lang }}</field>
<field name="auto_delete" eval="True"/>
<field name="body_html" type="html">