diff options
author | Zoltan Flamis <zoltan@innocraft.com> | 2021-02-23 05:37:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-23 05:37:37 +0300 |
commit | 45fbd45ba47ed2d8ed0ea96e46d5c62d8d4f5264 (patch) | |
tree | c4d9de0eb014dabfa533d8161b0bd2855c8923c0 /plugins | |
parent | 2e238b04e66f610a051a9434f2ee5aca05ccbe28 (diff) |
16990 export url token (#17227)
* change the token in the Export URL
* add UI test for the export url
* make export button works again
* fix UI test for the export url
* modify ui test for export url
* use ENTER_YOUR_TOKEN_AUTH_HERE as string
* fix UI test image for the export url
* fix UI test image for the export url
* fix absolute path
* Update reportexport.popover.html
* fix es6 related issue
* fix es6 related issue
Diffstat (limited to 'plugins')
5 files changed, 30 insertions, 5 deletions
diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php index 8b4459b99d..aa5d05416a 100644 --- a/plugins/CoreHome/CoreHome.php +++ b/plugins/CoreHome/CoreHome.php @@ -469,6 +469,7 @@ class CoreHome extends \Piwik\Plugin $translationKeys[] = 'CoreHome_RowLimit'; $translationKeys[] = 'CoreHome_ExportFormat'; $translationKeys[] = 'CoreHome_ExportTooltip'; + $translationKeys[] = 'CoreHome_ExportTooltipWithLink'; $translationKeys[] = 'CoreHome_FlattenReport'; $translationKeys[] = 'CoreHome_CustomLimit'; $translationKeys[] = 'CoreHome_ExpandSubtables'; diff --git a/plugins/CoreHome/angularjs/report-export/reportexport.directive.js b/plugins/CoreHome/angularjs/report-export/reportexport.directive.js index 039aadcb48..a842619ca7 100644 --- a/plugins/CoreHome/angularjs/report-export/reportexport.directive.js +++ b/plugins/CoreHome/angularjs/report-export/reportexport.directive.js @@ -30,7 +30,12 @@ scope.showUrl = false; - scope.getExportLink = function() { + scope.getExportLinkWithoutToken = function() { + return scope.getExportLink(false); + } + + scope.getExportLink = function(withToken) { + withToken = (typeof withToken !== 'undefined') ? withToken : true; var dataTable = scope.dataTable; var format = scope.reportFormat; @@ -185,8 +190,14 @@ } } - exportUrlParams.token_auth = piwik.token_auth; - exportUrlParams.force_api_session = 1; + + exportUrlParams.token_auth = 'ENTER_YOUR_TOKEN_AUTH_HERE'; + + if (withToken === true) { + exportUrlParams.token_auth = piwik.token_auth; + exportUrlParams.force_api_session = 1; + } + exportUrlParams.filter_limit = limit; var currentUrl = $location.absUrl(); diff --git a/plugins/CoreHome/angularjs/report-export/reportexport.popover.html b/plugins/CoreHome/angularjs/report-export/reportexport.popover.html index e46645a4ac..f206424602 100644 --- a/plugins/CoreHome/angularjs/report-export/reportexport.popover.html +++ b/plugins/CoreHome/angularjs/report-export/reportexport.popover.html @@ -61,7 +61,8 @@ </div> <div class="col l12" ng-show="showUrl"> - <textarea piwik-select-on-focus readonly class="exportFullUrl" title="{{ 'CoreHome_ExportTooltip'|translate }}">{{ getExportLink() }}</textarea> + <textarea piwik-select-on-focus readonly class="exportFullUrl">{{ getExportLinkWithoutToken() }}</textarea> + <div class="tooltip" ng-bind-html="'CoreHome_ExportTooltipWithLink'|translate:'<a target=_blank href=\'?module=UsersManager&action=userSecurity\'>':'</a>':'ENTER_YOUR_TOKEN_AUTH_HERE'"></div> </div> <div class="col l12"> diff --git a/plugins/CoreHome/angularjs/report-export/reportexport.popover.less b/plugins/CoreHome/angularjs/report-export/reportexport.popover.less index 6509cd8129..303340e11c 100644 --- a/plugins/CoreHome/angularjs/report-export/reportexport.popover.less +++ b/plugins/CoreHome/angularjs/report-export/reportexport.popover.less @@ -38,4 +38,15 @@ cursor: pointer; text-decoration: underline; } + + .tooltip { + color: @color-silver; + font-size: 13px; + padding: 5px; + } + + .tooltip > a { + color: @color-blue-piwik; + text-decoration: underline; + } }
\ No newline at end of file diff --git a/plugins/CoreHome/lang/en.json b/plugins/CoreHome/lang/en.json index d7f1157f7a..99fd0ff0bf 100644 --- a/plugins/CoreHome/lang/en.json +++ b/plugins/CoreHome/lang/en.json @@ -104,7 +104,8 @@ "RowLimit": "Row limit", "CustomLimit": "Custom limit", "ExportFormat": "Export format", - "ExportTooltip": "Note: The generated export URL will only work in the current browser session. If you want to use it somewhere else you need to use an app specific token. You can configure these tokens in Admin -> Security -> Token Auths.", + "ExportTooltip": "Note: To use the generated export URL, you will need to specify an app token auth. You can configure these tokens in Admin -> Security -> Token Auths.", + "ExportTooltipWithLink": "Note: To use the generated export URL, you will need to specify an app token auth. You can configure these tokens in %1$s[Admin -> Security -> Auths Tokens]%2$s. Replace %3$s in the Export URL by your Auth token. Warning: Never share the URL with the real token with anyone else.", "ExpandSubtables": "Expand subtables", "StandardReport": "Standard report", "FlattenReport": "Flatten report", |