summaryrefslogtreecommitdiffstats
path: root/settings/src
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2019-03-01 09:15:56 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2019-03-01 16:46:22 +0100
commitd2fc298fcd53ff9acaf4f0705e41760dae7d7de6 (patch)
treee9bd70acccf8b7a8236b546524889996356bba55 /settings/src
parentdf55781814f07afaaca437310e3f667aa78c1d2a (diff)
downloadnextcloud-server-d2fc298fcd53ff9acaf4f0705e41760dae7d7de6.tar.gz
nextcloud-server-d2fc298fcd53ff9acaf4f0705e41760dae7d7de6.zip
Add app token QR codes for mobile apps
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'settings/src')
-rw-r--r--settings/src/components/AuthTokenSetupDialogue.vue25
1 files changed, 24 insertions, 1 deletions
diff --git a/settings/src/components/AuthTokenSetupDialogue.vue b/settings/src/components/AuthTokenSetupDialogue.vue
index 020f4695c79..000e873e659 100644
--- a/settings/src/components/AuthTokenSetupDialogue.vue
+++ b/settings/src/components/AuthTokenSetupDialogue.vue
@@ -63,14 +63,27 @@
{{ t('settings', 'Done') }}
</button>
</div>
+ <div class="app-password-row">
+ <span class="app-password-label"></span>
+ <a v-if="!showQR"
+ @click="showQR = true">
+ {{ t('settings', 'Show QR code for mobile apps') }}
+ </a>
+ <QR v-else
+ :value="qrUrl"></QR>
+ </div>
</div>
</template>
<script>
+ import QR from '@chenfengyuan/vue-qrcode';
import confirmPassword from 'nextcloud-password-confirmation';
export default {
name: 'AuthTokenSetupDialogue',
+ components: {
+ QR,
+ },
props: {
add: {
type: Function,
@@ -85,6 +98,8 @@
appPassword: '',
loginName: '',
passwordCopied: false,
+ showQR: false,
+ qrUrl: '',
hoveringCopyButton: false,
}
},
@@ -124,9 +139,13 @@
this.adding = true;
this.loginName = token.loginName;
this.appPassword = token.token;
+
+ const server = window.location.protocol + '//' + window.location.host + OC.getRootPath();
+ this.qrUrl = `nc://login/user:${token.loginName}&password:${token.token}&server:${server}`;
+
this.$nextTick(() => {
this.$refs.appPassword.select();
- })
+ });
})
.catch(err => {
console.error('could not create a new app password', err);
@@ -146,6 +165,8 @@
reset () {
this.adding = false;
this.loading = false;
+ this.showQR = false;
+ this.qrUrl = '';
this.deviceName = '';
this.appPassword = '';
this.loginName = '';
@@ -172,6 +193,8 @@
.app-password-label {
display: table-cell;
padding-right: 1em;
+ text-align: right;
+ vertical-align: middle;
}
.monospaced {