[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) <tde@openerp.com>
This commit is contained in:
Fabio Barbero
2021-10-12 11:44:40 +00:00
parent c81b46d5e6
commit 2d65d022d9
7 changed files with 38 additions and 10 deletions
+4
View File
@@ -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()
+1 -1
View File
@@ -51,7 +51,7 @@
<div class="col o_wprofile_email_validation_container mb16">
<t t-call="website_profile.email_validation_banner">
<t t-set="redirect_url" t-value="'/forum/%s' % forum.id"/>
<t t-set="send_validation_email_message">Click here to send a verification email allowing you to participate in the forum.</t>
<t t-set="additional_validation_email_message"> and join this Forum</t>
<t t-set="additional_validated_email_message"> You may now participate in our forums.</t>
</t>
<div class="row">
@@ -2,3 +2,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import main
from . import portal
@@ -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
@@ -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');
}
});
},
@@ -283,7 +283,7 @@
<div class="o_wprofile_email_validation_container mb16 mt16">
<t t-call="website_profile.email_validation_banner">
<t t-set="redirect_url" t-value="'/profile/user/%s' % user.id"/>
<t t-set="send_validation_email_message">Click here to send a verification email.</t>
<t t-set="additional_validation_email_message"/>
</t>
</div>
<div id="profile_about_badge" class="mb32">
@@ -627,13 +627,22 @@
<template id="email_validation_banner">
<t t-set="send_alert_classes" t-value="send_alert_classes if send_alert_classes else 'alert alert-danger alert-dismissable'"/>
<t t-set="done_alert_classes" t-value="done_alert_classes if done_alert_classes else 'alert alert-success alert-dismissable'"/>
<t t-set="my_account_redirect" t-value="'/my/account?redirect='+redirect_url"/>
<div t-if="not validation_email_sent and not is_public_user and user.karma == 0" t-att-class="send_alert_classes" role="alert">
<div t-if="not is_public_user and not user.email" t-att-class="send_alert_classes" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">×</button>
Your account does not have an email set up. Please set it up on <a class="alert-link" t-att-href="my_account_redirect">your account settings</a>.
</div>
<div t-elif="not validation_email_sent and not is_public_user and user.karma == 0" t-att-class="send_alert_classes" role="alert">
<button type="button" class="close validation_email_close" data-dismiss="alert" aria-label="Close">×</button>
It appears your email has not been verified.<br/>
<a class="send_validation_email alert-link" href="#" t-att-data-redirect_url="redirect_url">
<span t-esc="send_validation_email_message"/>
</a>
Your Account has not yet been verified.<br/>
Click <a class="send_validation_email alert-link" href="#" t-att-data-redirect_url="redirect_url"><u>here</u></a> to receive a verification email<t t-esc="additional_validation_email_message"/>!
</div>
<div t-elif="validation_email_sent and not validation_email_done" t-att-class="done_alert_classes">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">×</button>
Verification Email sent to <i t-esc="user.email"></i>!<br/>
Did not receive it? <a class="alert-link" t-att-href="my_account_redirect"><u>Correct your email address</u></a>
or <a class="send_validation_email alert-link" href="#" t-att-data-redirect_url="redirect_url"><u>Send Again</u></a>.
</div>
<div t-if="validation_email_done" t-att-class="done_alert_classes" role="status">
<button type="button" class="close validated_email_close" data-dismiss="alert" aria-label="Close">×</button>
@@ -45,7 +45,7 @@
<t t-set="redirect_url" t-value="'/slides'"/>
<t t-set="send_alert_classes" t-value="'alert alert-danger alert-dismissable mt-4 mb-0'"/>
<t t-set="done_alert_classes" t-value="'alert alert-success alert-dismissable mt-4 mb-0'"/>
<t t-set="send_validation_email_message">Click here to send a verification email allowing you to participate at the eLearning.</t>
<t t-set="additional_validation_email_message"> and join this Community</t>
<t t-set="additional_validated_email_message"> You may now participate in our eLearning.</t>
</t>
</div>
@@ -251,7 +251,7 @@
<div class="o_wprofile_email_validation_container mb16 mt16">
<t t-call="website_profile.email_validation_banner">
<t t-set="redirect_url" t-value="'/slides'"/>
<t t-set="send_validation_email_message">Click here to send a verification email allowing you to participate at the eLearning.</t>
<t t-set="additional_validation_email_message"> and join this Community</t>
<t t-set="additional_validated_email_message"> You may now participate in our eLearning.</t>
</t>
</div>