diff options
| author | David Beguin <dbe@odoo.com> | 2019-02-20 16:54:36 +0000 |
|---|---|---|
| committer | David Beguin <dbe@odoo.com> | 2019-03-15 14:58:28 +0000 |
| commit | fb40c6bf6018f7f208201e1d4a4d413fd2ce3080 (patch) | |
| tree | d6df1ec5f2e7aca08311a51fad7f2ab3162a6806 /addons/website_profile/static | |
| parent | bbedcdb19054527940fb040a0d4f22115d5be265 (diff) | |
[IMP] website(_profile,_forum,_slides): move validation email to profile and use in forum and elearning
Email validation was necessary on the forum to be able to begin to use the forum
(ask or answer questions, vote, etc..)
As the new elearning also uses karma since 705376a982d64fb41800f148a167ef0fc28ce4c6,
the email validation is now also necessary in the eLearning platform.
This is why this commit is moving the email validation process to website_profile
and extend website_slides (eLearning) and website_forum to use this feature.
In function of where the user asked to send him the validation email,
the user is redirected on the forum or on the elearning when he clicks on
'Validate my account' in the received 'email validation' email.
Task ID : 1943788
PR #31321
Diffstat (limited to 'addons/website_profile/static')
| -rw-r--r-- | addons/website_profile/static/src/js/website_profile.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/addons/website_profile/static/src/js/website_profile.js b/addons/website_profile/static/src/js/website_profile.js new file mode 100644 index 00000000000..a3cc18f53f5 --- /dev/null +++ b/addons/website_profile/static/src/js/website_profile.js @@ -0,0 +1,47 @@ +odoo.define('website_profile.website_profile', function (require) { +'use strict'; + +var sAnimations = require('website.content.snippets.animation'); + +//TODO DBE : to change into publicWidget = require('web.public.widget'); after forward port in master +sAnimations.registry.websiteProfile = sAnimations.Class.extend({ + selector: '.o_wprofile_email_validation_container', + read_events: { + 'click .send_validation_email': '_onSendValidationEmailClick', + 'click .validated_email_close': '_onCloseValidatedEmailClick', + }, + + //-------------------------------------------------------------------------- + // Handlers + //-------------------------------------------------------------------------- + /** + * @private + * @param {Event} ev + */ + _onSendValidationEmailClick: function (ev) { + ev.preventDefault(); + var self = this; + var $element = $(ev.currentTarget); + this._rpc({ + route: '/profile/send_validation_email', + params: {'redirect_url': $element.data('redirect_url')}, + }).then(function (data) { + if (data) { + self.$('button.validation_email_close').click(); + } + }); + }, + + /** + * @private + */ + _onCloseValidatedEmailClick: function () { + this._rpc({ + route: '/profile/validate_email/close', + }); + }, +}); + +return sAnimations.registry.websiteProfile; + +}); |
