diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2017-02-15 20:18:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-15 20:18:48 +0100 |
commit | 2d8b7b875b8f9a3bf06c6808fd241da0c9498422 (patch) | |
tree | 0019e20e6dd6c42937a579d25aaef55ddeec1fef | |
parent | 52ef851da32be72dcf7b2a0c7e1386581f9dfda6 (diff) | |
parent | 3295fe2eb74695d4549da8d27d9427c20302487e (diff) | |
download | nextcloud-server-2d8b7b875b8f9a3bf06c6808fd241da0c9498422.tar.gz nextcloud-server-2d8b7b875b8f9a3bf06c6808fd241da0c9498422.zip |
Merge pull request #2704 from nextcloud/2fa-fix-backup-codes-print
print the backup codes tab and not the current one
-rw-r--r-- | apps/twofactor_backupcodes/js/settingsview.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/apps/twofactor_backupcodes/js/settingsview.js b/apps/twofactor_backupcodes/js/settingsview.js index 76396023120..753644fb210 100644 --- a/apps/twofactor_backupcodes/js/settingsview.js +++ b/apps/twofactor_backupcodes/js/settingsview.js @@ -59,16 +59,16 @@ total: this._total, used: this._used, codes: this._codes, - download: this._getDownloadDataHref() + download: this._getDownloadData() })); }, - _getDownloadDataHref: function () { + _getDownloadData: function () { if (!this._codes) { return ''; } - return 'data:text/plain,' + encodeURIComponent(_.reduce(this._codes, function (prev, code) { - return prev + code + "\r\n"; - }, '')); + return _.reduce(this._codes, function (prev, code) { + return prev + code + "<br>"; + }, ''); }, _load: function () { this._loading = true; @@ -113,10 +113,12 @@ }); }, _onPrintBackupCodes: function () { - var url = this._getDownloadDataHref(); - window.open(url, t('twofactor_backupcodes', 'Nextcloud backup codes')); - window.print(); - window.close(); + var data = this._getDownloadData(); + var newTab = window.open('', t('twofactor_backupcodes', 'Nextcloud backup codes')); + newTab.document.write('<h1>' + t('twofactor_backupcodes', 'Nextcloud backup codes') + '</h1>'); + newTab.document.write(data); + newTab.print(); + newTab.close(); } }); |