Use name from theme when downloading/printing twofactor backup codes.

Signed-off-by: Joachim Bauch <bauch@struktur.de>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Joachim Bauch 2019-03-25 10:50:18 +01:00 committed by Christoph Wurst
parent fce1ddc04e
commit 10aab0cdab
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
4 changed files with 15 additions and 7 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
export function print (data) { export function print (data) {
const newTab = window.open('', t('twofactor_backupcodes', 'Nextcloud backup codes')); const name = OC.theme.name || 'Nextcloud';
newTab.document.write('<h1>' + t('twofactor_backupcodes', 'Nextcloud backup codes') + '</h1>'); 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.document.write('<pre>' + data + '</pre>');
newTab.print(); newTab.print();
newTab.close(); newTab.close();

View File

@ -15,7 +15,7 @@
</ul> </ul>
<a :href="downloadUrl" <a :href="downloadUrl"
class="button primary" 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" <button class="button"
v-on:click="printCodes">{{ t('twofactor_backupcodes', 'Print backup codes') }}</button> v-on:click="printCodes">{{ t('twofactor_backupcodes', 'Print backup codes') }}</button>
</template> </template>
@ -52,6 +52,10 @@
return prev + code + '\r\n'; return prev + code + '\r\n';
}, '')); }, ''));
}, },
downloadFilename: function() {
const name = OC.theme.name || 'Nextcloud';
return name + '-backup-codes.txt';
},
enabled: function() { enabled: function() {
return this.$store.state.enabled return this.$store.state.enabled
}, },
@ -63,6 +67,9 @@
}, },
codes: function() { codes: function() {
return this.$store.state.codes return this.$store.state.codes
},
name: function() {
return OC.theme.name || 'Nextcloud'
} }
}, },
methods: { methods: {