From f9a6d7d6458dac357e139a4ce06b774dd6999ac0 Mon Sep 17 00:00:00 2001
From: Hugo Trentesaux <hugo@le-filament.com>
Date: Tue, 4 Mar 2025 13:46:13 +0100
Subject: [PATCH] improve form pre-completion

---
 controllers/main.py                   | 5 +++++
 views/auth_signup_login_templates.xml | 1 +
 2 files changed, 6 insertions(+)

diff --git a/controllers/main.py b/controllers/main.py
index bf32fc5..7c8ee7b 100644
--- a/controllers/main.py
+++ b/controllers/main.py
@@ -1,6 +1,11 @@
 from odoo import http, tools, _
+from odoo.addons.web.controllers.home import SIGN_UP_REQUEST_PARAMS
+
 from odoo.addons.auth_signup.controllers.main import AuthSignupHome
 
+# add firstname and lastname to qcontext whitelist
+SIGN_UP_REQUEST_PARAMS.update({"firstname", "lastname"})
+
 class SolagroAuthSignupHome(AuthSignupHome):
     @http.route('/web/signup', type='http', auth='public', website=True, sitemap=False)
     def web_auth_signup(self, **post):
diff --git a/views/auth_signup_login_templates.xml b/views/auth_signup_login_templates.xml
index 5ef96e8..3638e23 100644
--- a/views/auth_signup_login_templates.xml
+++ b/views/auth_signup_login_templates.xml
@@ -15,6 +15,7 @@
         <xpath expr="//input[@id='login']" position="attributes">
             <attribute name="type">email</attribute>
             <attribute name="name">email</attribute>
+            <attribute name="t-att-value">email</attribute>
             <attribute name="t-attf-class">form-control {{'is-invalid' if error_email else ''}}</attribute>
         </xpath>
 
-- 
GitLab