Merge pull request #14829 from nextcloud/backupcodes-theme-name
Use name from theme when downloading/printing twofactor backup codes.
This commit is contained in:
commit
87fbaf501a
4 changed files with 11 additions and 3 deletions
Binary file not shown.
Binary file not shown.
|
@ -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();
|
||||
|
|
|
@ -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>
|
||||
|
@ -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
|
||||
},
|
||||
|
@ -63,6 +67,9 @@
|
|||
},
|
||||
codes: function() {
|
||||
return this.$store.state.codes
|
||||
},
|
||||
name: function() {
|
||||
return OC.theme.name || 'Nextcloud'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
Loading…
Reference in a new issue