mirror of
https://github.com/bringout/oca-ocb-security.git
synced 2026-04-21 03:32:11 +02:00
19.0 vanilla
This commit is contained in:
parent
20ddc1b4a3
commit
c0efcc53f5
1162 changed files with 125577 additions and 105287 deletions
|
|
@ -1,19 +1,18 @@
|
|||
odoo.define('auth_totp_mail.tours', function(require) {
|
||||
"use strict";
|
||||
|
||||
const tour = require('web_tour.tour');
|
||||
import { registry } from "@web/core/registry";
|
||||
import { stepUtils } from "@web_tour/tour_utils";
|
||||
|
||||
function openAccountSettingsTab() {
|
||||
return [{
|
||||
content: 'Go to settings',
|
||||
trigger: '[data-menu-xmlid="base.menu_administration"]'
|
||||
trigger: '[data-menu-xmlid="base.menu_administration"]',
|
||||
run: "click",
|
||||
}, {
|
||||
content: 'Wait for page',
|
||||
trigger: '.o_menu_brand:contains("Settings")',
|
||||
run: () => {}
|
||||
}, {
|
||||
content: "Open Users menu",
|
||||
trigger: '[data-menu-xmlid="base.menu_users"]'
|
||||
trigger: '[data-menu-xmlid="base.menu_users"]',
|
||||
run: "click",
|
||||
}, {
|
||||
content: "Open Users view",
|
||||
trigger: '[data-menu-xmlid="base.menu_action_res_users"]',
|
||||
|
|
@ -24,53 +23,44 @@ function openAccountSettingsTab() {
|
|||
// selection get discarded by the action reloading, so here try to
|
||||
// see if we're already on the users action through the breadcrumb and
|
||||
// just close the menu if so
|
||||
const $crumb = $('.breadcrumb');
|
||||
if ($crumb.text().indexOf('Users') === -1) {
|
||||
const breadcrumb = document.querySelector('.breadcrumb');
|
||||
if (!breadcrumb || !breadcrumb.textContent.includes("Users")) {
|
||||
// on general settings page, click menu
|
||||
helpers.click();
|
||||
} else {
|
||||
// else close menu
|
||||
helpers.click($('[data-menu-xmlid="base.menu_users"]'));
|
||||
helpers.click('[data-menu-xmlid="base.menu_users"]');
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
tour.register('totp_admin_self_invite', {
|
||||
test: true,
|
||||
url: '/web'
|
||||
}, [tour.stepUtils.showAppsMenuItem(), ...openAccountSettingsTab(), {
|
||||
registry.category("web_tour.tours").add('totp_admin_self_invite', {
|
||||
url: '/odoo',
|
||||
steps: () => [stepUtils.showAppsMenuItem(), ...openAccountSettingsTab(), {
|
||||
content: "open the user's form",
|
||||
trigger: "td.o_data_cell:contains(admin)",
|
||||
run: "click",
|
||||
}, {
|
||||
content: "go to Account security Tab",
|
||||
trigger: "a.nav-link:contains(Account Security)",
|
||||
content: "go to Security Tab",
|
||||
trigger: "a.nav-link:contains(Security)",
|
||||
run: "click",
|
||||
}, {
|
||||
content: "check that user cannot invite themselves to use 2FA.",
|
||||
trigger: "body",
|
||||
run: function () {
|
||||
const inviteBtn = $('button:contains(Invite to use 2FA)')[0];
|
||||
if (!inviteBtn) {
|
||||
$('body').addClass('CannotInviteYourself');
|
||||
}
|
||||
}
|
||||
}, {
|
||||
content: "check that user cannot invite themself.",
|
||||
trigger: "body.CannotInviteYourself"
|
||||
}]);
|
||||
trigger: "body:not(:has(button:contains(Invite to use 2FA)))",
|
||||
}]});
|
||||
|
||||
tour.register('totp_admin_invite', {
|
||||
test: true,
|
||||
url: '/web'
|
||||
}, [tour.stepUtils.showAppsMenuItem(), ...openAccountSettingsTab(), {
|
||||
registry.category("web_tour.tours").add('totp_admin_invite', {
|
||||
url: '/odoo',
|
||||
steps: () => [stepUtils.showAppsMenuItem(), ...openAccountSettingsTab(), {
|
||||
content: "open the user's form",
|
||||
trigger: "td.o_data_cell:contains(demo)",
|
||||
trigger: "td.o_data_cell:contains(test_user)",
|
||||
run: "click",
|
||||
}, {
|
||||
content: "go to Account security Tab",
|
||||
trigger: "a.nav-link:contains(Account Security)",
|
||||
content: "go to security Tab",
|
||||
trigger: "a.nav-link:contains(Security)",
|
||||
run: "click",
|
||||
}, {
|
||||
content: "check that demo user can be invited to use 2FA.",
|
||||
content: "check that test_user user can be invited to use 2FA.",
|
||||
trigger: "button:contains(Invite to use 2FA)",
|
||||
}]);
|
||||
|
||||
});
|
||||
}]});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue