Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use name from theme when downloading/printing twofactor backup codes.
Signed-off-by: Joachim Bauch <[email protected]>
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
fancycode authored and ChristophWurst committed Mar 26, 2019
commit 10aab0cdab53d7d3389d04b2c3712b223bbc0971
6 changes: 3 additions & 3 deletions apps/twofactor_backupcodes/js/settings.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/twofactor_backupcodes/js/settings.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions apps/twofactor_backupcodes/src/service/PrintService.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export function print (data) {
const newTab = window.open('', t('twofactor_backupcodes', 'Nextcloud backup codes'));
newTab.document.write('<h1>' + t('twofactor_backupcodes', 'Nextcloud backup codes') + '</h1>');
const name = OC.theme.name || 'Nextcloud';
const newTab = window.open('', t('twofactor_backupcodes', '{name} backup codes', {name: name}));
newTab.document.write('<h1>' + t('twofactor_backupcodes', '{name} backup codes', {name: name}) + '</h1>');
newTab.document.write('<pre>' + data + '</pre>');
newTab.print();
newTab.close();
Expand Down
9 changes: 8 additions & 1 deletion apps/twofactor_backupcodes/src/views/PersonalSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</ul>
<a :href="downloadUrl"
class="button primary"
download="Nextcloud-backup-codes.txt">{{ t('twofactor_backupcodes', 'Save backup codes') }}</a>
:download="downloadFilename">{{ t('twofactor_backupcodes', 'Save backup codes') }}</a>
<button class="button"
v-on:click="printCodes">{{ t('twofactor_backupcodes', 'Print backup codes') }}</button>
</template>
Expand Down Expand Up @@ -52,6 +52,10 @@
return prev + code + '\r\n';
}, ''));
},
downloadFilename: function() {
const name = OC.theme.name || 'Nextcloud';
return name + '-backup-codes.txt';
},
enabled: function() {
return this.$store.state.enabled
},
Expand All @@ -63,6 +67,9 @@
},
codes: function() {
return this.$store.state.codes
},
name: function() {
return OC.theme.name || 'Nextcloud'
}
},
methods: {
Expand Down