refs #5489 fix(account/sync), fix(order) catalog-search-panel popover
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2023-06-07 13:34:13 +02:00
parent abf454496d
commit edc601fd5d
9 changed files with 43 additions and 40 deletions

View File

@ -24,6 +24,7 @@ module.exports = Self => {
fields: ['email'], fields: ['email'],
where: {name: user} where: {name: user}
}); });
if (!account) return;
user = account.email; user = account.email;
} }

View File

@ -98,20 +98,20 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType`
VALUES VALUES
(1, 978, 1, 0, 2000, 9, 0); (1, 978, 1, 0, 2000, 9, 0);
INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`, `password`,`role`,`active`,`email`,`lang`, `image`) INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`, `image`)
VALUES VALUES
(1101, 'BruceWayne', 'Bruce Wayne', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es', 'e7723f0b24ff05b32ed09d95196f2f29'), (1101, 'BruceWayne', 'Bruce Wayne', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'BruceWayne@mydomain.com', 'es', 'e7723f0b24ff05b32ed09d95196f2f29'),
(1102, 'PetterParker', 'Petter Parker', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'), (1102, 'PetterParker', 'Petter Parker', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'PetterParker@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'),
(1103, 'ClarkKent', 'Clark Kent', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr', 'e7723f0b24ff05b32ed09d95196f2f29'), (1103, 'ClarkKent', 'Clark Kent', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'ClarkKent@mydomain.com', 'fr', 'e7723f0b24ff05b32ed09d95196f2f29'),
(1104, 'TonyStark', 'Tony Stark', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'es', 'e7723f0b24ff05b32ed09d95196f2f29'), (1104, 'TonyStark', 'Tony Stark', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'TonyStark@mydomain.com', 'es', 'e7723f0b24ff05b32ed09d95196f2f29'),
(1105, 'MaxEisenhardt', 'Max Eisenhardt', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt', 'e7723f0b24ff05b32ed09d95196f2f29'), (1105, 'MaxEisenhardt', 'Max Eisenhardt', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt', 'e7723f0b24ff05b32ed09d95196f2f29'),
(1106, 'DavidCharlesHaller', 'David Charles Haller', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'), (1106, 'DavidCharlesHaller', 'David Charles Haller', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 1, 1, 'DavidCharlesHaller@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'),
(1107, 'HankPym', 'Hank Pym', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'), (1107, 'HankPym', 'Hank Pym', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 1, 1, 'HankPym@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'),
(1108, 'CharlesXavier', 'Charles Xavier', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'), (1108, 'CharlesXavier', 'Charles Xavier', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 1, 1, 'CharlesXavier@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'),
(1109, 'BruceBanner', 'Bruce Banner', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'), (1109, 'BruceBanner', 'Bruce Banner', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 1, 1, 'BruceBanner@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'),
(1110, 'JessicaJones', 'Jessica Jones', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'en', NULL), (1110, 'JessicaJones', 'Jessica Jones', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 1, 1, 'JessicaJones@mydomain.com', 'en', NULL),
(1111, 'Missing', 'Missing', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'en', NULL), (1111, 'Missing', 'Missing', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 0, NULL, 'en', NULL),
(1112, 'Trash', 'Trash', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'en', NULL); (1112, 'Trash', 'Trash', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2', 2, 0, NULL, 'en', NULL);
UPDATE account.`user` UPDATE account.`user`
SET passExpired = DATE_SUB(util.VN_CURDATE(), INTERVAL 1 YEAR) SET passExpired = DATE_SUB(util.VN_CURDATE(), INTERVAL 1 YEAR)

View File

@ -4,7 +4,7 @@ const $ = {
form: 'vn-out-layout form' form: 'vn-out-layout form'
}; };
fdescribe('ChangePassword path', async() => { describe('ChangePassword path', async() => {
let browser; let browser;
let page; let page;
beforeAll(async() => { beforeAll(async() => {

View File

@ -2,7 +2,6 @@
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
const UserError = require('vn-loopback/util/user-error'); const UserError = require('vn-loopback/util/user-error');
const utils = require('loopback/lib/utils'); const utils = require('loopback/lib/utils');
const {util} = require('webpack');
module.exports = function(Self) { module.exports = function(Self) {
Self.ParameterizedSQL = ParameterizedSQL; Self.ParameterizedSQL = ParameterizedSQL;

View File

@ -9,7 +9,7 @@ describe('account changePassword()', () => {
error = e.message; error = e.message;
} }
expect(error).toContain('Invalid password'); expect(error).toContain('Invalid current password');
}); });
it('should change password', async() => { it('should change password', async() => {

View File

@ -25,16 +25,21 @@ module.exports = Self => {
}); });
Self.sync = async function(userName, password, force, options) { Self.sync = async function(userName, password, force, options) {
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
const models = Self.app.models; const models = Self.app.models;
const user = await models.VnUser.findOne({ const user = await models.VnUser.findOne({
fields: ['id'], fields: ['id'],
where: {name: userName} where: {name: userName}
}, options); }, myOptions);
const isSync = !await models.UserSync.exists(userName, options); const isSync = !await models.UserSync.exists(userName, myOptions);
if (!force && isSync && user) return; if (!force && isSync && user) return;
await models.AccountConfig.syncUser(userName, password); await models.AccountConfig.syncUser(userName, password);
await models.UserSync.destroyById(userName, options); await models.UserSync.destroyById(userName, myOptions);
}; };
}; };

View File

@ -1,5 +1,5 @@
const app = require('vn-loopback/server/server'); const models = require('vn-loopback/server/server').models;
module.exports = Self => { module.exports = Self => {
Object.assign(Self, { Object.assign(Self, {
@ -63,7 +63,7 @@ module.exports = Self => {
Object.assign(Self.prototype, { Object.assign(Self.prototype, {
async synchronizerInit() { async synchronizerInit() {
let mailConfig = await app.models.MailConfig.findOne({ let mailConfig = await models.MailConfig.findOne({
fields: ['domain'] fields: ['domain']
}); });
@ -91,8 +91,6 @@ module.exports = Self => {
}, },
async synchronizerSyncUser(userName, password, syncGroups) { async synchronizerSyncUser(userName, password, syncGroups) {
let $ = app.models;
if (!userName) return; if (!userName) return;
userName = userName.toLowerCase(); userName = userName.toLowerCase();
@ -100,7 +98,7 @@ module.exports = Self => {
if (['administrator', 'root'].indexOf(userName) >= 0) if (['administrator', 'root'].indexOf(userName) >= 0)
return; return;
let user = await $.VnUser.findOne({ let user = await models.VnUser.findOne({
where: {name: userName}, where: {name: userName},
fields: [ fields: [
'id', 'id',
@ -138,7 +136,7 @@ module.exports = Self => {
}; };
if (user) { if (user) {
let exists = await $.Account.exists(user.id); let exists = await models.Account.exists(user.id);
Object.assign(info, { Object.assign(info, {
hasAccount: user.active && exists, hasAccount: user.active && exists,
corporateMail: `${userName}@${this.domain}`, corporateMail: `${userName}@${this.domain}`,

View File

@ -23,7 +23,7 @@ class Controller extends SearchPanel {
addValue() { addValue() {
this.filter.values.push({}); this.filter.values.push({});
setTimeout(() => this.popover.relocate()); setTimeout(() => this.parentPopover.relocate());
} }
changeTag() { changeTag() {
@ -36,7 +36,7 @@ ngModule.vnComponent('vnOrderCatalogSearchPanel', {
controller: Controller, controller: Controller,
bindings: { bindings: {
onSubmit: '&?', onSubmit: '&?',
popover: '<?', parentPopover: '<?',
resultTags: '<?' resultTags: '<?'
} }
}); });

View File

@ -18,7 +18,7 @@
</vn-searchbar> </vn-searchbar>
</vn-portal> </vn-portal>
<vn-order-catalog-view <vn-order-catalog-view
model="model" model="model"
order="$ctrl.order"> order="$ctrl.order">
</vn-order-catalog-view> </vn-order-catalog-view>
<vn-side-menu side="right"> <vn-side-menu side="right">
@ -31,7 +31,7 @@
label="Category"> label="Category">
</vn-autocomplete> </vn-autocomplete>
<vn-one ng-repeat="category in categories"> <vn-one ng-repeat="category in categories">
<vn-icon <vn-icon
ng-class="{'active': $ctrl.categoryId == category.id}" ng-class="{'active': $ctrl.categoryId == category.id}"
icon="{{::category.icon}}" icon="{{::category.icon}}"
vn-tooltip="{{::category.name}}" vn-tooltip="{{::category.name}}"
@ -83,7 +83,7 @@
</div> </div>
</vn-vertical> </vn-vertical>
<vn-vertical class="input vn-pt-md"> <vn-vertical class="input vn-pt-md">
<vn-textfield vn-one <vn-textfield vn-one
vn-id="search" vn-id="search"
ng-keyUp="$ctrl.onSearchByTag($event)" ng-keyUp="$ctrl.onSearchByTag($event)"
label="Search tag"> label="Search tag">
@ -104,20 +104,20 @@
on-close="$ctrl.onPopoverClose()"> on-close="$ctrl.onPopoverClose()">
<vn-order-catalog-search-panel <vn-order-catalog-search-panel
on-submit="$ctrl.onPanelSubmit($filter)" on-submit="$ctrl.onPanelSubmit($filter)"
popover="popover" parent-popover="popover"
result-tags="$ctrl.resultTags"> result-tags="$ctrl.resultTags">
</vn-order-catalog-search-panel> </vn-order-catalog-search-panel>
</vn-popover> </vn-popover>
<div class="chips"> <div class="chips">
<vn-chip <vn-chip
ng-if="$ctrl.itemId" ng-if="$ctrl.itemId"
removable="true" removable="true"
vn-tooltip="Item id" vn-tooltip="Item id"
on-remove="$ctrl.removeItemId()" on-remove="$ctrl.removeItemId()"
class="colored"> class="colored">
<span>Id: {{$ctrl.itemId}}</span> <span>Id: {{$ctrl.itemId}}</span>
</vn-chip> </vn-chip>
<vn-chip <vn-chip
ng-if="$ctrl.itemName" ng-if="$ctrl.itemName"
removable="true" removable="true"
vn-tooltip="Item" vn-tooltip="Item"
@ -130,20 +130,20 @@
<span>{{$ctrl.itemName}}</span> <span>{{$ctrl.itemName}}</span>
</div> </div>
</vn-chip> </vn-chip>
<vn-chip <vn-chip
ng-if="category.selection" ng-if="category.selection"
removable="true" removable="true"
vn-tooltip="Category" vn-tooltip="Category"
on-remove="$ctrl.categoryId = null" on-remove="$ctrl.categoryId = null"
class="colored"> class="colored">
<span translate>{{category.selection.name}}</span> <span translate>{{category.selection.name}}</span>
</vn-chip> </vn-chip>
<vn-chip <vn-chip
ng-if="type.selection" ng-if="type.selection"
removable="true" removable="true"
vn-tooltip="Type" vn-tooltip="Type"
on-remove="$ctrl.typeId = null" on-remove="$ctrl.typeId = null"
class="colored"> class="colored">
<span translate>{{type.selection.name}}</span> <span translate>{{type.selection.name}}</span>
</vn-chip> </vn-chip>
<vn-chip <vn-chip
@ -151,7 +151,7 @@
removable="true" removable="true"
on-remove="$ctrl.remove($index)" on-remove="$ctrl.remove($index)"
vn-tooltip="{{::$ctrl.formatTooltip(tagGroup)}}" vn-tooltip="{{::$ctrl.formatTooltip(tagGroup)}}"
class="colored"> class="colored">
<div> <div>
<span ng-if="::tagGroup.tagFk"> <span ng-if="::tagGroup.tagFk">
<span translate>{{::tagGroup.tagSelection.name}}</span>: <span translate>{{::tagGroup.tagSelection.name}}</span>:
@ -163,4 +163,4 @@
</div> </div>
</vn-chip> </vn-chip>
</div> </div>
</vn-side-menu> </vn-side-menu>