mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 08:44:07 -04:00
print and close the new tab, not the current one when printing backup codes
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
b1a82969e6
commit
e111015afa
1 changed files with 10 additions and 9 deletions
|
|
@ -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,11 @@
|
|||
});
|
||||
},
|
||||
_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(data);
|
||||
newTab.print();
|
||||
newTab.close();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue