Skip to content

Commit 1a21d4f

Browse files
committed
Fix the button to scan API Key QR code
1 parent 385771f commit 1a21d4f

2 files changed

Lines changed: 9316 additions & 3208 deletions

File tree

web/pages/settings/index.vue

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,42 @@
8282
copy-text="Copy API Key"
8383
notification-text="API Key copied successfully"
8484
></copy-button>
85-
<v-btn
86-
color="primary"
87-
@click="showQrCodeDialog = true"
85+
<v-btn
86+
v-if="$vuetify.breakpoint.mdAndUp"
87+
color="primary"
8888
class="ml-4"
89+
@click="showQrCodeDialog = true"
8990
>
90-
<v-icon left>{{ mdiQrcode }}</v-icon>
91-
Show QR Code
91+
<v-icon left>{{ mdiQrcode }}</v-icon>
92+
Show QR Code
9293
</v-btn>
93-
<v-dialog v-model="showQrCodeDialog" max-width="400px">
94+
<v-dialog
95+
v-model="showQrCodeDialog"
96+
overlay-opacity="0.9"
97+
max-width="400px"
98+
>
9499
<v-card>
95-
<v-card-title>API Key QR Code</v-card-title>
96-
<v-card-text>
100+
<v-card-title class="justify-center"
101+
>API Key QR Code</v-card-title
102+
>
103+
<v-card-subtitle class="mt-2 text-center"
104+
>Scan this QR code with the
105+
<a :href="$store.getters.getAppData.appDownloadUrl"
106+
>httpSMS app</a
107+
>
108+
on your Android phone to login.</v-card-subtitle
109+
>
110+
<v-card-text class="text-center">
97111
<canvas ref="qrCodeCanvas"></canvas>
98112
</v-card-text>
99113
<v-card-actions>
100-
<v-spacer></v-spacer>
101-
<v-btn color="primary" text @click="showQrCodeDialog = false">Close</v-btn>
114+
<v-btn
115+
color="primary"
116+
block
117+
class="mb-4"
118+
@click="showQrCodeDialog = false"
119+
>Close</v-btn
120+
>
102121
</v-card-actions>
103122
</v-card>
104123
</v-dialog>
@@ -831,8 +850,8 @@ export default Vue.extend({
831850
showQrCodeDialog(newVal) {
832851
if (newVal && this.apiKey) {
833852
this.$nextTick(() => {
834-
this.generateQrCode(this.apiKey);
835-
});
853+
this.generateQrCode(this.apiKey)
854+
})
836855
}
837856
},
838857
},
@@ -852,13 +871,16 @@ export default Vue.extend({
852871
853872
methods: {
854873
generateQrCode(text) {
855-
const canvas = this.$refs.qrCodeCanvas;
874+
const canvas = this.$refs.qrCodeCanvas
856875
if (canvas) {
857876
QRCode.toCanvas(canvas, text, { errorCorrectionLevel: 'H' }, (err) => {
858877
if (err) {
859-
console.error(err);
878+
this.$store.dispatch('addNotification', {
879+
message: 'Failed to generate API key QR code',
880+
type: 'error',
881+
})
860882
}
861-
});
883+
})
862884
}
863885
},
864886
updateEmailNotifications() {

0 commit comments

Comments
 (0)