From 2d65d022d91c657238a28ea14b39cd2dbcddef9e Mon Sep 17 00:00:00 2001 From: Fabio Barbero Date: Fri, 1 Oct 2021 09:48:30 +0000 Subject: [PATCH] [IMP] website_slides: change confirmation messages for email Purpose ======= Clean up messages related to email verification. Specification ============= Rephrase messages, add confirmation of email sent and let user change email. Do not show "Validation Email sent" if the current user changed their email address. PR: https://github.com/odoo/odoo/pull/77617 Task-2647065 closes odoo/odoo#77617 Signed-off-by: Thibault Delavallee (tde) --- addons/portal/controllers/portal.py | 4 ++++ addons/website_forum/views/website_forum.xml | 2 +- .../website_profile/controllers/__init__.py | 1 + addons/website_profile/controllers/portal.py | 14 +++++++++++++ .../static/src/js/website_profile.js | 2 +- .../website_profile/views/website_profile.xml | 21 +++++++++++++------ .../website_slides_templates_homepage.xml | 4 ++-- 7 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 addons/website_profile/controllers/portal.py diff --git a/addons/portal/controllers/portal.py b/addons/portal/controllers/portal.py index dd31f68e770..40987c58047 100644 --- a/addons/portal/controllers/portal.py +++ b/addons/portal/controllers/portal.py @@ -179,6 +179,7 @@ class CustomerPortal(Controller): except: values[field] = False values.update({'zip': values.pop('zipcode', '')}) + self.on_account_update(values, partner) partner.sudo().write(values) if redirect: return request.redirect(redirect) @@ -200,6 +201,9 @@ class CustomerPortal(Controller): response.headers['X-Frame-Options'] = 'DENY' return response + def on_account_update(self, values, partner): + pass + @route('/my/security', type='http', auth='user', website=True, methods=['GET', 'POST']) def security(self, **post): values = self._prepare_portal_layout_values() diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml index 1419ff17ee7..98dafb19842 100644 --- a/addons/website_forum/views/website_forum.xml +++ b/addons/website_forum/views/website_forum.xml @@ -51,7 +51,7 @@
- Click here to send a verification email allowing you to participate in the forum. + and join this Forum You may now participate in our forums.
diff --git a/addons/website_profile/controllers/__init__.py b/addons/website_profile/controllers/__init__.py index 5d4b25db9c0..d8f273d4230 100644 --- a/addons/website_profile/controllers/__init__.py +++ b/addons/website_profile/controllers/__init__.py @@ -2,3 +2,4 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import main +from . import portal diff --git a/addons/website_profile/controllers/portal.py b/addons/website_profile/controllers/portal.py new file mode 100644 index 00000000000..748b0e53a1f --- /dev/null +++ b/addons/website_profile/controllers/portal.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo.addons.portal.controllers import portal +from odoo.http import request + + +class CustomerPortal(portal.CustomerPortal): + + def on_account_update(self, values, partner): + super().on_account_update(values, partner) + # Do not show "Validation Email sent" if the current user changed their email address + if values["email"] != partner.email: + request.session['validation_email_sent'] = False diff --git a/addons/website_profile/static/src/js/website_profile.js b/addons/website_profile/static/src/js/website_profile.js index 1525eaa0fd8..aff7124dcca 100644 --- a/addons/website_profile/static/src/js/website_profile.js +++ b/addons/website_profile/static/src/js/website_profile.js @@ -27,7 +27,7 @@ publicWidget.registry.websiteProfile = publicWidget.Widget.extend({ params: {'redirect_url': $element.data('redirect_url')}, }).then(function (data) { if (data) { - self.$('button.validation_email_close').click(); + window.location = $element.data('redirect_url'); } }); }, diff --git a/addons/website_profile/views/website_profile.xml b/addons/website_profile/views/website_profile.xml index 6b96b3dc865..42de7cb90ac 100644 --- a/addons/website_profile/views/website_profile.xml +++ b/addons/website_profile/views/website_profile.xml @@ -283,7 +283,7 @@
- Click here to send a verification email. +
@@ -627,13 +627,22 @@