2FAuth/public/build/assets/Start-CJ1-KH4-.js.map

1 line
6.5 KiB
Plaintext
Raw Normal View History

2024-11-27 12:03:02 +01:00
{"version":3,"file":"Start-CJ1-KH4-.js","sources":["../../../resources/js/views/Start.vue"],"sourcesContent":["<script setup>\n import Form from '@/components/formElements/Form'\n import { useUserStore } from '@/stores/user'\n import { useBusStore } from '@/stores/bus'\n import { useNotifyStore } from '@/stores/notify'\n import { useTwofaccounts } from '@/stores/twofaccounts'\n\n const router = useRouter()\n const user = useUserStore()\n const bus = useBusStore()\n const notify = useNotifyStore()\n const twofaccounts = useTwofaccounts()\n\n const qrcodeInput = ref(null)\n const qrcodeInputLabel = ref(null)\n const form = reactive(new Form({\n qrcode: null,\n inputFormat: 'fileUpload',\n }))\n \n\n /**\n * Upload the submitted QR code file to the backend for decoding, then route the user\n * to the Create or Import form with decoded URI to prefill the form\n */\n function submitQrCode() {\n form.clear()\n form.qrcode = qrcodeInput.value.files[0]\n\n form.upload('/api/v1/qrcode/decode', { returnError: true }).then(response => {\n if (response.data.data.slice(0, 33).toLowerCase() === \"otpauth-migration://offline?data=\") {\n bus.migrationUri = response.data.data\n router.push({ name: 'importAccounts' })\n }\n else {\n bus.decodedUri = response.data.data\n router.push({ name: 'createAccount' })\n }\n })\n .catch(error => {\n if (error.response.status !== 422) {\n notify.alert({ text: error.response.data.message })\n }\n })\n }\n\n /**\n * Push user to the dedicated capture view for live scan\n */\n function capture() {\n router.push({ name: 'capture' });\n }\n\n onMounted(() => {\n if( user.preferences.useDirectCapture && user.preferences.defaultCaptureMode === 'upload' ) {\n qrcodeInputLabel.value.click()\n }\n })\n</script>\n\n<template>\n <!-- static landing UI -->\n <div class=\"container has-text-centered\">\n <div class=\"columns quick-uploader\">\n <!-- trailer phrase that invite to add an account -->\n <div class=\"column is-full quick-uploader-header\" :class=\"{ 'is-invisible' : twofaccounts.count !== 0 }\">\n {{ $t('twofaccounts.no_account_here') }}<br>\n {{ $t('twofaccounts.add_first_account') }}\n </div>\n <!-- Livescan button -->\n <div class=\"column is-full quick-uploader-button\" >\n <div class=\"quick-uploader-centerer\">\n <!-- upload a qr code (with basic file field and backend decoding) -->\n <label role=\"button\" tabindex=\"0\" v-if=\"user.preferences.useBasicQrcodeReader\" class=\"button is-link is-medium is-rounded is-main\" ref=\"qrcodeInputLabel\" @keyup.enter=\"qrcodeInputLabel.click()\">\n <input aria-hidden=\"true\" tabindex=\"-1\" class=\"file-input\" type=\"file\" accept=\"image/*\" v-on:change=\"submitQrCode\" ref=\"qrcodeInput\">\n {{ $t('twofaccounts.forms.upload_qrcode') }}\n </label>\n <!-- scan button that launch camera stream -->\n <button v-else type=\"button\" class=\"button is-link is-medium is-rounded is-main\" @click=\"capture()\">\n {{ $t('twofaccounts.forms.scan_qrcode') }}\n </button>\n </div>\n <FieldError v-if=\"form.errors.hasAny('qrcode')\" :error=\"form.errors.get('qrcode')\" :field=\"'qrcode'\" />\n </div>\n <!-- alternative methods -->\n <div class=\"column is-full\">\n <div class=\"block light-or-darker\">{{ $t('twofaccounts.forms.alternative_methods') }}</div>\n <!-- upload a qr code -->\n <div class=\"block has-text-link\" v-if=\"!user.preferences.useBasicQrc