summaryrefslogtreecommitdiff
path: root/addons/website/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-02-26 16:39:30 +0100
committerChristophe Simonis <chs@odoo.com>2019-02-26 16:39:30 +0100
commitff9c9341d6ed4e9ab18a0aa02e79441999d658f1 (patch)
tree47ffd01e071d3783cff6013cfc4b6c3d8e47a841 /addons/website/static/src
parentbc84fdf71b15ad419f8693861aea682ee751f85c (diff)
parentfcb972db9dc778eeaf7d6b6ba3638c78d93998ad (diff)
[MERGE] forward port branch saas-12.2 up to fcb972db9dc
Diffstat (limited to 'addons/website/static/src')
-rw-r--r--addons/website/static/src/js/tours/website_tour_reset_password.js172
-rw-r--r--addons/website/static/src/scss/website.editor.ui.scss4
-rw-r--r--addons/website/static/src/scss/website.ui.scss8
-rw-r--r--addons/website/static/src/xml/website.pageProperties.xml4
4 files changed, 182 insertions, 6 deletions
diff --git a/addons/website/static/src/js/tours/website_tour_reset_password.js b/addons/website/static/src/js/tours/website_tour_reset_password.js
new file mode 100644
index 00000000000..307b741ceef
--- /dev/null
+++ b/addons/website/static/src/js/tours/website_tour_reset_password.js
@@ -0,0 +1,172 @@
+odoo.define('website.tour_reset_password', function (require) {
+'use strict';
+
+var localStorage = require('web.local_storage');
+var rpc = require('web.rpc');
+var tour = require('web_tour.tour');
+require('web.dom_ready');
+
+var currentDomain = window.location.protocol + '//' + window.location.hostname;
+var emailsUrl = '/web#action=mail.action_view_mail_mail&view_type=list';
+var usersUrl = '/web#action=base.action_res_users&view_type=list';
+var resetLinkKey = 'website.tour_reset_password.resetLink';
+
+tour.register('website_reset_password', {
+ test: true,
+ url: '/web',
+},
+[
+ {
+ content: "Change the domain of the websites and go to users page",
+ trigger: '.oe_topbar_name:contains("Admin")',
+ run: function () {
+ // We could do it with the UI but this is not the goal of this test,
+ // so we just make an RPC to be faster.
+
+ // We change the domain of the website to test that the email that
+ // will be sent uses the correct domain for its links.
+ var def1 = rpc.query({
+ 'model': 'website',
+ 'method': 'write',
+ 'args': [[1], {
+ 'domain': "my-test-domain.com",
+ }],
+ });
+ // We need to change the domain of all the websites otherwise the
+ // website selector will return the website 2 since the domain we
+ // set on website 1 doesn't actually match our test server.
+ var def2 = rpc.query({
+ 'model': 'website',
+ 'method': 'write',
+ 'args': [[2], {
+ 'domain': "https://domain-not-used.fr",
+ }],
+ });
+ // Set a website on "Admin" partner to test the URL of the website.
+ var def3 = rpc.query({
+ model: 'res.partner',
+ method: 'name_search',
+ kwargs: {'name': 'Mitchell Admin'},
+ }).then(function (res) {
+ return rpc.query({
+ 'model': 'res.partner',
+ 'method': 'write',
+ 'args': [[res[0][0]], {
+ 'website_id': 1,
+ }],
+ });
+ });
+
+ return $.when(def1, def2, def3).then(function () {
+ window.location.href = usersUrl;
+ });
+ },
+ },
+ {
+ content: "click on Admin",
+ trigger: '.o_data_cell:contains("Admin")',
+ },
+ {
+ content: "click on reset password",
+ trigger: '.btn[name="action_reset_password"]',
+ },
+ {
+ content: "wait mail to be sent, and go see it",
+ trigger: 'a[name="signup_url"][href^="http://my-test-domain.com"]',
+ run: function () {
+ window.location.href = emailsUrl;
+ },
+ },
+ {
+ content: "click on the first email",
+ trigger: '.o_data_cell:contains("Password reset"):eq(0)',
+ },
+ {
+ content: "check email has the button",
+ trigger: 'div.oe_form_field_html[name="body_html"] a:contains("Change password")',
+ run: function () {},
+ },
+ {
+ content: "check the URL is correct too",
+ trigger: 'div.oe_form_field_html[name="body_html"] a:contains("Change password")[href^="http://my-test-domain.com"]',
+ run: function () {
+ // reset the domain of the websites, go to users page
+ return rpc.query({
+ 'model': 'website',
+ 'method': 'write',
+ 'args': [[1, 2], {
+ 'domain': "",
+ }],
+ }).then(function () {
+ window.location.href = usersUrl;
+ });
+ },
+ },
+ {
+ content: "click on Admin",
+ trigger: '.o_data_cell:contains("Admin")',
+ },
+ {
+ content: "click on reset password",
+ trigger: '.btn[name="action_reset_password"]',
+ },
+ {
+ content: "wait mail to be sent, and go see it",
+ trigger: 'a[name="signup_url"][href^="' + currentDomain + '"]',
+ run: function () {
+ window.location.href = emailsUrl;
+ },
+ },
+ {
+ content: "click on the first email",
+ trigger: '.o_data_cell:contains("Password reset"):eq(0)',
+ },
+ {
+ content: "check the link has the current host, save the link, logout",
+ trigger: 'div.oe_form_field_html[name="body_html"] a:contains("Change password")[href^="' + currentDomain + '"]',
+ run: function () {
+ var link = $('div.oe_form_field_html[name="body_html"] a:contains("Change password")').attr('href');
+ localStorage.setItem(resetLinkKey, link);
+ window.location.href = "/web/session/logout?redirect=/";
+ },
+ },
+ {
+ content: "go to the reset link",
+ trigger: 'a[href="/web/login"]',
+ run: function () {
+ window.location.href = localStorage.getItem(resetLinkKey);
+ },
+ },
+ {
+ content: "fill new password and submit",
+ trigger: '.oe_reset_password_form',
+ run: function () {
+ var $form = $('.oe_reset_password_form');
+ $form.find('input[name="password"]').val('adminadmin');
+ // password must be at least 8 if the module `auth_password_policy`
+ // is installed which is the case on runbot
+ $form.find('input[name="confirm_password"]').val('adminadmin');
+ $form.find('button[type="submit"]').click();
+ },
+ },
+ {
+ content: "check logged in, and reset admin website",
+ trigger: '.oe_topbar_name:contains("Admin")',
+ run: function () {
+ return rpc.query({
+ model: 'res.partner',
+ method: 'name_search',
+ kwargs: {'name': 'Admin'},
+ }).then(function (res) {
+ return rpc.query({
+ 'model': 'res.partner',
+ 'method': 'write',
+ 'args': [[res[0][0]], {
+ 'website_id': false,
+ }],
+ });
+ });
+ },
+ },
+]);
+});
diff --git a/addons/website/static/src/scss/website.editor.ui.scss b/addons/website/static/src/scss/website.editor.ui.scss
index aa5cba39e00..353be1efed1 100644
--- a/addons/website/static/src/scss/website.editor.ui.scss
+++ b/addons/website/static/src/scss/website.editor.ui.scss
@@ -34,7 +34,7 @@
&:checked+span {
box-shadow: none;
- background-image: linear-gradient(0deg, $o-we-color-success, darken($o-we-color-success, 10%));
+ background: $o-we-color-success;
&:after {
margin-left: ($o-we-switch-size*1.8 - $o-we-switch-size) + 0.1;
@@ -46,7 +46,7 @@
>input {
&:not(:checked)+span {
box-shadow: none;
- background-image: linear-gradient(0deg, lighten(theme-color('danger'), 5%), darken(theme-color('danger'), 5%));
+ background: $o-we-color-danger;
}
}
}
diff --git a/addons/website/static/src/scss/website.ui.scss b/addons/website/static/src/scss/website.ui.scss
index 6865a8b7e79..cb6fbb94fcb 100644
--- a/addons/website/static/src/scss/website.ui.scss
+++ b/addons/website/static/src/scss/website.ui.scss
@@ -134,10 +134,14 @@ body .modal {
cursor: pointer;
font-family: $o-we-font-family;
+ &, .close {
+ color: white;
+ }
+
h4 {
- color: lightgray;
- font-family:inherit;
+ font-family: inherit;
font-weight: normal;
+ color: inherit;
.fa {
margin-left: $grid-gutter-width/2;
diff --git a/addons/website/static/src/xml/website.pageProperties.xml b/addons/website/static/src/xml/website.pageProperties.xml
index 8ad1d995ce5..348da5e9c17 100644
--- a/addons/website/static/src/xml/website.pageProperties.xml
+++ b/addons/website/static/src/xml/website.pageProperties.xml
@@ -49,7 +49,7 @@
<div class="form-group row">
<label class="col-form-label col-md-3" for="page_name">Page Name</label>
<div class="col-md-9">
- <input type="text" class="form-control form-control-sm" id="page_name" t-att-value="widget.page.name" />
+ <input type="text" class="form-control" id="page_name" t-att-value="widget.page.name" />
</div>
</div>
<div class="form-group warn_about_call"></div>
@@ -60,7 +60,7 @@
<div class="input-group-prepend">
<span class="input-group-text" t-att-title="widget.serverUrl"><small><t t-esc="widget.serverUrlTrunc"/></small></span>
</div>
- <input type="text" class="form-control form-control-sm" id="page_url" t-att-value="widget.page.url" />
+ <input type="text" class="form-control" id="page_url" t-att-value="widget.page.url" />
</div>
</div>
</div>