From e4c1f1f92114ca03947e9932935e4b4195ae1604 Mon Sep 17 00:00:00 2001 From: diosmosis Date: Mon, 15 Jul 2019 21:33:25 -0700 Subject: Keep top level nb_visits_converted metric (#14253) * Do not remove nb_visits_converted when archiving goal reports since it should differ from sum of conversions. * If metric is not available, compute dynamically by using max nb_visits_converted. * Ignore abandoned cart conversions when calculating visit converted. * In case goals column is empty. * remove processed metric code since it is not correct * do not remove visits converted metric for overview * fix tests * Fixing test * fix test * update test files * update submodules * Update expected screenshots & try to fix some random failures. * Update expected UI test export results. * two ui test fixes * Fix couple UI test failures. * fix random php test failure --- plugins/CoreHome/Columns/Metrics/ConversionRate.php | 2 +- plugins/CustomDimensions | 2 +- ...emTest__CustomVariables.getCustomVariables_day.xml | 16 ++++++++++++++++ plugins/Dashboard/tests/UI/Dashboard_spec.js | 2 +- .../expected/test___DevicesDetection.getBrand_day.xml | 4 ++++ .../expected/test___DevicesDetection.getModel_day.xml | 6 ++++++ .../expected/test___DevicesDetection.getType_day.xml | 4 ++++ .../Integration/Commands/AnalyzeArchiveTableTest.php | 2 +- ...ationPerServerTime__API.getProcessedReport_day.xml | 2 +- ...erceOrderWithItems__API.getProcessedReport_day.xml | 1 + ...hItems__CustomVariables.getCustomVariables_day.xml | 6 ++++++ ...ommerceOrderWithItems__UserCountry.getCity_day.xml | 1 + ...ceOrderWithItems__UserCountry.getContinent_day.xml | 1 + ...erceOrderWithItems__UserCountry.getCountry_day.xml | 2 ++ ...merceOrderWithItems__UserCountry.getRegion_day.xml | 1 + ...VisitTime.getVisitInformationPerServerTime_day.xml | 2 ++ plugins/Feedback/tests/UI/FeedbackPopup_spec.js | 1 + ...VisitTime.getVisitInformationPerServerTime_day.xml | 1 + plugins/MarketingCampaignsReporting | 2 +- ...rs_getReferrerType__API.getProcessedReport_day.xml | 2 +- ...erialized__Referrers.getReferrerType_year.original | Bin 2864 -> 2898 bytes .../tests/UI/SegmentSelectorEditor_spec.js | 2 +- .../SegmentSelectorEditorTest_suggested_values.png | 4 ++-- plugins/Transitions/tests/UI/Transitions_spec.js | 1 + ...WorkingWithSomeData__UserCountry.getCity_month.xml | 5 +++++ ...ngWithSomeData__UserCountry.getContinent_month.xml | 3 +++ ...kingWithSomeData__UserCountry.getCountry_month.xml | 6 ++++++ ...rkingWithSomeData__UserCountry.getRegion_month.xml | 5 +++++ plugins/UsersManager/UsersManager.php | 17 +++++++++++++++++ .../user-edit-form/user-edit-form.component.html | 1 + .../user-edit-form/user-edit-form.component.js | 4 +++- 31 files changed, 97 insertions(+), 11 deletions(-) (limited to 'plugins') diff --git a/plugins/CoreHome/Columns/Metrics/ConversionRate.php b/plugins/CoreHome/Columns/Metrics/ConversionRate.php index 86c2cd26ee..4c07d9febf 100644 --- a/plugins/CoreHome/Columns/Metrics/ConversionRate.php +++ b/plugins/CoreHome/Columns/Metrics/ConversionRate.php @@ -8,6 +8,7 @@ namespace Piwik\Plugins\CoreHome\Columns\Metrics; use Piwik\DataTable\Row; +use Piwik\Metrics; use Piwik\Metrics\Formatter; use Piwik\Piwik; use Piwik\Plugin\ProcessedMetric; @@ -45,7 +46,6 @@ class ConversionRate extends ProcessedMetric { $nbVisitsConverted = $this->getMetric($row, 'nb_visits_converted'); $nbVisits = $this->getMetric($row, 'nb_visits'); - return Piwik::getQuotientSafe($nbVisitsConverted, $nbVisits, $precision = 4); } } \ No newline at end of file diff --git a/plugins/CustomDimensions b/plugins/CustomDimensions index 86b5944d0b..ace2c823de 160000 --- a/plugins/CustomDimensions +++ b/plugins/CustomDimensions @@ -1 +1 @@ -Subproject commit 86b5944d0b534f4cd7f33ecf7bd40a6921ce74f8 +Subproject commit ace2c823de488a6408c664fcf56082fc00fdd417 diff --git a/plugins/CustomVariables/tests/System/expected/test_CustomVariablesSystemTest__CustomVariables.getCustomVariables_day.xml b/plugins/CustomVariables/tests/System/expected/test_CustomVariablesSystemTest__CustomVariables.getCustomVariables_day.xml index 766be4e97d..c8033f43ad 100644 --- a/plugins/CustomVariables/tests/System/expected/test_CustomVariablesSystemTest__CustomVariables.getCustomVariables_day.xml +++ b/plugins/CustomVariables/tests/System/expected/test_CustomVariablesSystemTest__CustomVariables.getCustomVariables_day.xml @@ -8,6 +8,7 @@ 1 4 1 + 1 1 @@ -33,6 +34,7 @@ 1 4 1 + 1 1 @@ -53,6 +55,7 @@ 1 4 1 + 1 1 @@ -78,6 +81,7 @@ 1 4 1 + 1 1 @@ -98,6 +102,7 @@ 1 4 1 + 1 1 @@ -123,6 +128,7 @@ 1 4 1 + 1 1 @@ -143,6 +149,7 @@ 1 4 1 + 1 1 @@ -168,6 +175,7 @@ 1 4 1 + 1 1 @@ -188,6 +196,7 @@ 1 4 1 + 1 1 @@ -213,6 +222,7 @@ 1 4 1 + 1 1 @@ -233,6 +243,7 @@ 1 4 1 + 1 1 @@ -258,6 +269,7 @@ 1 4 1 + 1 1 @@ -278,6 +290,7 @@ 1 4 1 + 1 1 @@ -303,6 +316,7 @@ 1 4 1 + 1 1 @@ -323,6 +337,7 @@ 1 4 1 + 1 1 @@ -348,6 +363,7 @@ 1 4 1 + 1 1 diff --git a/plugins/Dashboard/tests/UI/Dashboard_spec.js b/plugins/Dashboard/tests/UI/Dashboard_spec.js index 79ba8a86a6..3559a0602e 100644 --- a/plugins/Dashboard/tests/UI/Dashboard_spec.js +++ b/plugins/Dashboard/tests/UI/Dashboard_spec.js @@ -262,7 +262,7 @@ describe("Dashboard", function () { await page.click('li[data-action="createDashboard"]'); await page.waitForSelector('#createDashboardName'); // await animation await page.type('#createDashboardName', 'newdash2'); - await page.waitFor(100); + await page.waitFor(100); // sometimes the text doesn't seem to type fast enough var button = await page.jQuery('.modal.open .modal-footer a:contains(Ok)'); await button.click(); await page.mouse.move(-10, -10); diff --git a/plugins/DevicesDetection/tests/System/expected/test___DevicesDetection.getBrand_day.xml b/plugins/DevicesDetection/tests/System/expected/test___DevicesDetection.getBrand_day.xml index d6790fc1ae..703ec64682 100644 --- a/plugins/DevicesDetection/tests/System/expected/test___DevicesDetection.getBrand_day.xml +++ b/plugins/DevicesDetection/tests/System/expected/test___DevicesDetection.getBrand_day.xml @@ -9,6 +9,7 @@ 1 6 4 + 2 2 @@ -30,6 +31,7 @@ 1 1808 3 + 2 3 @@ -51,6 +53,7 @@ 2 721 0 + 1 1 @@ -98,6 +101,7 @@ 1 1084 1 + 1 1 diff --git a/plugins/DevicesDetection/tests/System/expected/test___DevicesDetection.getModel_day.xml b/plugins/DevicesDetection/tests/System/expected/test___DevicesDetection.getModel_day.xml index 6442db0437..2d6509f655 100644 --- a/plugins/DevicesDetection/tests/System/expected/test___DevicesDetection.getModel_day.xml +++ b/plugins/DevicesDetection/tests/System/expected/test___DevicesDetection.getModel_day.xml @@ -9,6 +9,7 @@ 1 3 2 + 1 1 @@ -29,6 +30,7 @@ 1 3 2 + 1 1 @@ -49,6 +51,7 @@ 1 724 2 + 1 2 @@ -69,6 +72,7 @@ 1 1084 1 + 1 1 @@ -89,6 +93,7 @@ 2 721 0 + 1 1 @@ -133,6 +138,7 @@ 1 1084 1 + 1 1 diff --git a/plugins/DevicesDetection/tests/System/expected/test___DevicesDetection.getType_day.xml b/plugins/DevicesDetection/tests/System/expected/test___DevicesDetection.getType_day.xml index 069641e689..6242c1719a 100644 --- a/plugins/DevicesDetection/tests/System/expected/test___DevicesDetection.getType_day.xml +++ b/plugins/DevicesDetection/tests/System/expected/test___DevicesDetection.getType_day.xml @@ -9,6 +9,7 @@ 1 1087 4 + 2 2 @@ -30,6 +31,7 @@ 2 724 2 + 2 2 @@ -51,6 +53,7 @@ 1 724 2 + 1 2 @@ -71,6 +74,7 @@ 1 1084 1 + 1 1 diff --git a/plugins/Diagnostics/tests/Integration/Commands/AnalyzeArchiveTableTest.php b/plugins/Diagnostics/tests/Integration/Commands/AnalyzeArchiveTableTest.php index 7fdc477111..844753bb10 100644 --- a/plugins/Diagnostics/tests/Integration/Commands/AnalyzeArchiveTableTest.php +++ b/plugins/Diagnostics/tests/Integration/Commands/AnalyzeArchiveTableTest.php @@ -82,7 +82,7 @@ Total # Invalidated Archives: 0 Total # Temporary Archives: 0 Total # Error Archives: 0 Total # Segment Archives: 162 -Total Size of Blobs: 24.3 K +Total Size of Blobs: 24.%d K OUTPUT; diff --git a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_Metadata_VisitTime.getVisitInformationPerServerTime__API.getProcessedReport_day.xml b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_Metadata_VisitTime.getVisitInformationPerServerTime__API.getProcessedReport_day.xml index d57b0e817b..3dfafacaae 100644 --- a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_Metadata_VisitTime.getVisitInformationPerServerTime__API.getProcessedReport_day.xml +++ b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_Metadata_VisitTime.getVisitInformationPerServerTime__API.getProcessedReport_day.xml @@ -401,6 +401,7 @@ 6 5403 0 + 2 1 @@ -426,7 +427,6 @@ 3 3121.11 - 1 4.3 \ No newline at end of file diff --git a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__API.getProcessedReport_day.xml b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__API.getProcessedReport_day.xml index 143bd8df41..31f3f57891 100644 --- a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__API.getProcessedReport_day.xml +++ b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__API.getProcessedReport_day.xml @@ -94,6 +94,7 @@ 6 5403 0 + 2 1 diff --git a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__CustomVariables.getCustomVariables_day.xml b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__CustomVariables.getCustomVariables_day.xml index f4c932cd2c..f12f1fc15e 100644 --- a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__CustomVariables.getCustomVariables_day.xml +++ b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__CustomVariables.getCustomVariables_day.xml @@ -8,6 +8,7 @@ 6 5403 0 + 2 2 @@ -49,6 +50,7 @@ 6 5403 0 + 2 2 @@ -85,6 +87,7 @@ 6 5403 0 + 2 2 @@ -126,6 +129,7 @@ 6 5403 0 + 2 2 @@ -280,6 +284,7 @@ 6 4682 0 + 1 2 @@ -316,6 +321,7 @@ 6 4682 0 + 1 2 diff --git a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__UserCountry.getCity_day.xml b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__UserCountry.getCity_day.xml index 1fbd1b3ea7..32f87f8b98 100644 --- a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__UserCountry.getCity_day.xml +++ b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__UserCountry.getCity_day.xml @@ -9,6 +9,7 @@ 6 5403 0 + 2 2 diff --git a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__UserCountry.getContinent_day.xml b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__UserCountry.getContinent_day.xml index a05ce1df11..9133dc0229 100644 --- a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__UserCountry.getContinent_day.xml +++ b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__UserCountry.getContinent_day.xml @@ -9,6 +9,7 @@ 6 5403 0 + 2 1 diff --git a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__UserCountry.getCountry_day.xml b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__UserCountry.getCountry_day.xml index c30519b3db..f645a7e3c8 100644 --- a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__UserCountry.getCountry_day.xml +++ b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__UserCountry.getCountry_day.xml @@ -9,6 +9,7 @@ 6 4682 0 + 1 2 @@ -43,6 +44,7 @@ 4 721 0 + 1 1 diff --git a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__UserCountry.getRegion_day.xml b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__UserCountry.getRegion_day.xml index 3d891a7b3e..ed6707d63a 100644 --- a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__UserCountry.getRegion_day.xml +++ b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__UserCountry.getRegion_day.xml @@ -9,6 +9,7 @@ 6 5403 0 + 2 2 diff --git a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__VisitTime.getVisitInformationPerServerTime_day.xml b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__VisitTime.getVisitInformationPerServerTime_day.xml index d1f4094adf..b2c3bf5c52 100644 --- a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__VisitTime.getVisitInformationPerServerTime_day.xml +++ b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems__VisitTime.getVisitInformationPerServerTime_day.xml @@ -9,6 +9,7 @@ 4 721 0 + 1 1 @@ -114,6 +115,7 @@ 3 721 0 + 0 1 diff --git a/plugins/Feedback/tests/UI/FeedbackPopup_spec.js b/plugins/Feedback/tests/UI/FeedbackPopup_spec.js index f5d9be094c..370ba4571b 100644 --- a/plugins/Feedback/tests/UI/FeedbackPopup_spec.js +++ b/plugins/Feedback/tests/UI/FeedbackPopup_spec.js @@ -30,6 +30,7 @@ describe("FeedbackPopup", function () { // Click on the "Remind me in 90 days" button = the popup shouldn't appear for the next test var remindLaterBtn = await modal.$$('.modal-footer .btn-flat'); await remindLaterBtn[0].click(); + await page.waitForNetworkIdle(); }); it('should not display popup when next reminder date is in future', async function () { diff --git a/plugins/Goals/tests/System/expected/test_trackGoals_allowMultipleConversionsPerVisit__VisitTime.getVisitInformationPerServerTime_day.xml b/plugins/Goals/tests/System/expected/test_trackGoals_allowMultipleConversionsPerVisit__VisitTime.getVisitInformationPerServerTime_day.xml index a5df90f990..4a3f7b7062 100644 --- a/plugins/Goals/tests/System/expected/test_trackGoals_allowMultipleConversionsPerVisit__VisitTime.getVisitInformationPerServerTime_day.xml +++ b/plugins/Goals/tests/System/expected/test_trackGoals_allowMultipleConversionsPerVisit__VisitTime.getVisitInformationPerServerTime_day.xml @@ -9,6 +9,7 @@ 3 363 0 + 2 2 diff --git a/plugins/MarketingCampaignsReporting b/plugins/MarketingCampaignsReporting index b531ab9581..0c3ab8aede 160000 --- a/plugins/MarketingCampaignsReporting +++ b/plugins/MarketingCampaignsReporting @@ -1 +1 @@ -Subproject commit b531ab9581bf05c678b9398bda99291bc57d7e92 +Subproject commit 0c3ab8aede3d2df3dcf3342b2a69c86adea8b46d diff --git a/plugins/Referrers/tests/System/expected/test_Referrers_getReferrerType__API.getProcessedReport_day.xml b/plugins/Referrers/tests/System/expected/test_Referrers_getReferrerType__API.getProcessedReport_day.xml index cedb63631b..07f605a12b 100644 --- a/plugins/Referrers/tests/System/expected/test_Referrers_getReferrerType__API.getProcessedReport_day.xml +++ b/plugins/Referrers/tests/System/expected/test_Referrers_getReferrerType__API.getProcessedReport_day.xml @@ -1196,7 +1196,7 @@ 1 11315 62 - 0 + 31 31 diff --git a/plugins/Referrers/tests/System/expected/test_phpSerialized__Referrers.getReferrerType_year.original b/plugins/Referrers/tests/System/expected/test_phpSerialized__Referrers.getReferrerType_year.original index 95308f2b8b..d1969c268a 100644 Binary files a/plugins/Referrers/tests/System/expected/test_phpSerialized__Referrers.getReferrerType_year.original and b/plugins/Referrers/tests/System/expected/test_phpSerialized__Referrers.getReferrerType_year.original differ diff --git a/plugins/SegmentEditor/tests/UI/SegmentSelectorEditor_spec.js b/plugins/SegmentEditor/tests/UI/SegmentSelectorEditor_spec.js index ccef0d4d03..8477f42b6c 100644 --- a/plugins/SegmentEditor/tests/UI/SegmentSelectorEditor_spec.js +++ b/plugins/SegmentEditor/tests/UI/SegmentSelectorEditor_spec.js @@ -94,7 +94,7 @@ describe("SegmentSelectorEditorTest", function () { it("should show suggested segment values when a segment value input is focused", async function() { await page.click('.segmentEditorPanel .segmentRow0 .ui-autocomplete-input'); await page.waitForNetworkIdle(); - await page.waitFor(250); + await page.waitFor(500); expect(await page.screenshotSelector(selectorsToCapture)).to.matchImage('suggested_values'); }); diff --git a/plugins/SegmentEditor/tests/UI/expected-screenshots/SegmentSelectorEditorTest_suggested_values.png b/plugins/SegmentEditor/tests/UI/expected-screenshots/SegmentSelectorEditorTest_suggested_values.png index b6b612b5a5..5cac8c7924 100644 --- a/plugins/SegmentEditor/tests/UI/expected-screenshots/SegmentSelectorEditorTest_suggested_values.png +++ b/plugins/SegmentEditor/tests/UI/expected-screenshots/SegmentSelectorEditorTest_suggested_values.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:14d28c45f38f021b7b8373b563f9b6f1740737edb1e943ea05f557f65caf80bf -size 34809 +oid sha256:fd0bf164f65454272cda6e97e3f9d7ec72a7a75934bdb2b59c011f414c3a1c9d +size 55067 diff --git a/plugins/Transitions/tests/UI/Transitions_spec.js b/plugins/Transitions/tests/UI/Transitions_spec.js index 576cd416c1..0738a0f35c 100644 --- a/plugins/Transitions/tests/UI/Transitions_spec.js +++ b/plugins/Transitions/tests/UI/Transitions_spec.js @@ -33,6 +33,7 @@ describe("Transitions", function () { await (await page.jQuery('a.actionTransitions:visible')).click(); await page.waitForNetworkIdle(); + await page.waitFor('.ui-dialog', { visible: true }); expect(await page.screenshotSelector('.ui-dialog')).to.matchImage('transitions_popup_titles'); }); diff --git a/plugins/UserCountry/tests/System/expected/test_AttributeHistoricalDataWithLocationsTest_testExecute_ShouldReturnLogAfterWorkingWithSomeData__UserCountry.getCity_month.xml b/plugins/UserCountry/tests/System/expected/test_AttributeHistoricalDataWithLocationsTest_testExecute_ShouldReturnLogAfterWorkingWithSomeData__UserCountry.getCity_month.xml index a61099a113..65485c5318 100644 --- a/plugins/UserCountry/tests/System/expected/test_AttributeHistoricalDataWithLocationsTest_testExecute_ShouldReturnLogAfterWorkingWithSomeData__UserCountry.getCity_month.xml +++ b/plugins/UserCountry/tests/System/expected/test_AttributeHistoricalDataWithLocationsTest_testExecute_ShouldReturnLogAfterWorkingWithSomeData__UserCountry.getCity_month.xml @@ -6,6 +6,7 @@ 61 5 11 + 22 22 @@ -36,6 +37,7 @@ 16 5 3 + 6 6 @@ -68,6 +70,7 @@ 7 5 2 + 3 3 @@ -100,6 +103,7 @@ 5 4 1 + 2 2 @@ -132,6 +136,7 @@ 6 5 1 + 2 2 diff --git a/plugins/UserCountry/tests/System/expected/test_AttributeHistoricalDataWithLocationsTest_testExecute_ShouldReturnLogAfterWorkingWithSomeData__UserCountry.getContinent_month.xml b/plugins/UserCountry/tests/System/expected/test_AttributeHistoricalDataWithLocationsTest_testExecute_ShouldReturnLogAfterWorkingWithSomeData__UserCountry.getContinent_month.xml index d1a6dc816d..73a3e725bc 100644 --- a/plugins/UserCountry/tests/System/expected/test_AttributeHistoricalDataWithLocationsTest_testExecute_ShouldReturnLogAfterWorkingWithSomeData__UserCountry.getContinent_month.xml +++ b/plugins/UserCountry/tests/System/expected/test_AttributeHistoricalDataWithLocationsTest_testExecute_ShouldReturnLogAfterWorkingWithSomeData__UserCountry.getContinent_month.xml @@ -6,6 +6,7 @@ 60 5 11 + 22 22 @@ -30,6 +31,7 @@ 22 5 4 + 8 8 @@ -54,6 +56,7 @@ 13 5 3 + 5 5 diff --git a/plugins/UserCountry/tests/System/expected/test_AttributeHistoricalDataWithLocationsTest_testExecute_ShouldReturnLogAfterWorkingWithSomeData__UserCountry.getCountry_month.xml b/plugins/UserCountry/tests/System/expected/test_AttributeHistoricalDataWithLocationsTest_testExecute_ShouldReturnLogAfterWorkingWithSomeData__UserCountry.getCountry_month.xml index ade01286fe..928cd44613 100644 --- a/plugins/UserCountry/tests/System/expected/test_AttributeHistoricalDataWithLocationsTest_testExecute_ShouldReturnLogAfterWorkingWithSomeData__UserCountry.getCountry_month.xml +++ b/plugins/UserCountry/tests/System/expected/test_AttributeHistoricalDataWithLocationsTest_testExecute_ShouldReturnLogAfterWorkingWithSomeData__UserCountry.getCountry_month.xml @@ -6,6 +6,7 @@ 55 5 10 + 20 20 @@ -33,6 +34,7 @@ 16 5 3 + 6 6 @@ -60,6 +62,7 @@ 7 5 2 + 3 3 @@ -87,6 +90,7 @@ 5 4 1 + 2 2 @@ -114,6 +118,7 @@ 6 5 1 + 2 2 @@ -141,6 +146,7 @@ 6 5 1 + 2 2 diff --git a/plugins/UserCountry/tests/System/expected/test_AttributeHistoricalDataWithLocationsTest_testExecute_ShouldReturnLogAfterWorkingWithSomeData__UserCountry.getRegion_month.xml b/plugins/UserCountry/tests/System/expected/test_AttributeHistoricalDataWithLocationsTest_testExecute_ShouldReturnLogAfterWorkingWithSomeData__UserCountry.getRegion_month.xml index 3004dbd1fb..9a1d8d248c 100644 --- a/plugins/UserCountry/tests/System/expected/test_AttributeHistoricalDataWithLocationsTest_testExecute_ShouldReturnLogAfterWorkingWithSomeData__UserCountry.getRegion_month.xml +++ b/plugins/UserCountry/tests/System/expected/test_AttributeHistoricalDataWithLocationsTest_testExecute_ShouldReturnLogAfterWorkingWithSomeData__UserCountry.getRegion_month.xml @@ -6,6 +6,7 @@ 61 5 11 + 22 22 @@ -34,6 +35,7 @@ 16 5 3 + 6 6 @@ -63,6 +65,7 @@ 7 5 2 + 3 3 @@ -92,6 +95,7 @@ 6 5 1 + 2 2 @@ -121,6 +125,7 @@ 5 4 1 + 2 2 diff --git a/plugins/UsersManager/UsersManager.php b/plugins/UsersManager/UsersManager.php index 4f72e98775..a844aee258 100644 --- a/plugins/UsersManager/UsersManager.php +++ b/plugins/UsersManager/UsersManager.php @@ -12,6 +12,7 @@ use Exception; use Piwik\Access\Role\Admin; use Piwik\Access\Role\Write; use Piwik\API\Request; +use Piwik\Auth\Password; use Piwik\Common; use Piwik\Option; use Piwik\Piwik; @@ -197,11 +198,27 @@ class UsersManager extends \Piwik\Plugin public static function getPasswordHash($password) { + self::checkBasicPasswordStrength($password); + // if change here, should also edit the installation process // to change how the root pwd is saved in the config file return md5($password); } + public static function checkBasicPasswordStrength($password) + { + $ex = new \Exception('This password is too weak, please supply another value or reset it.'); + + $numDistinctCharacters = strlen(count_chars($password, 3)); + if ($numDistinctCharacters < 2) { + throw $ex; + } + + if (strlen($password) < 6) { + throw $ex; + } + } + /** * Checks the password hash length. Used as a sanity check. * diff --git a/plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.html b/plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.html index 8c831c87c5..32e8d9dd84 100644 --- a/plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.html +++ b/plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.html @@ -56,6 +56,7 @@ ng-model="$ctrl.user.password" data-title="Password" data-disabled="$ctrl.isSavingUserInfo || ($ctrl.currentUserRole != 'superuser' && !$ctrl.isAdd)" + ng-change="$ctrl.isPasswordModified = true" > diff --git a/plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.js b/plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.js index 852469dbc1..5c3a88d0a3 100644 --- a/plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.js +++ b/plugins/UsersManager/angularjs/user-edit-form/user-edit-form.component.js @@ -35,6 +35,7 @@ vm.firstSiteAccess = null; vm.isUserModified = false; vm.passwordConfirmation = ''; + vm.isPasswordModified = false; vm.$onInit = $onInit; vm.$onChanges = $onChanges; @@ -187,7 +188,7 @@ method: 'UsersManager.updateUser' }, { userLogin: vm.user.login, - password: vm.user.password ? vm.user.password : undefined, + password: (vm.isPasswordModified && vm.user.password) ? vm.user.password : undefined, passwordConfirmation: vm.passwordConfirmation ? vm.passwordConfirmation : undefined, email: vm.user.email, alias: vm.user.alias @@ -199,6 +200,7 @@ vm.isSavingUserInfo = false; vm.passwordConfirmation = false; vm.isUserModified = true; + vm.isPasswordModified = false; showUserSavedNotification(); }); -- cgit v1.2.3