mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-03 22:01:45 +01:00
1 line
6.5 KiB
Plaintext
1 line
6.5 KiB
Plaintext
{"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.useBasicQrcodeReader\">\n <label role=\"button\" tabindex=\"0\" class=\"button is-link is-outlined is-rounded\" 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 </div>\n <!-- link to advanced form -->\n <div class=\"block has-text-link\">\n <RouterLink class=\"button is-link is-outlined is-rounded\" :to=\"{ name: 'createAccount' }\" >\n {{ $t('twofaccounts.forms.use_advanced_form') }}\n </RouterLink>\n </div>\n <!-- link to import view -->\n <div class=\"block has-text-link\">\n <RouterLink id=\"btnImport\" class=\"button is-link is-outlined is-rounded\" :to=\"{ name: 'importAccounts' }\" >\n {{ $t('twofaccounts.import.import') }}\n </RouterLink>\n </div>\n </div>\n </div>\n <!-- Footer -->\n <VueFooter :showButtons=\"true\" >\n <ButtonBackCloseCancel :returnTo=\"{ name: 'accounts' }\" action=\"back\" v-if=\"!twofaccounts.isEmpty\" />\n </VueFooter>\n </div>\n</template>\n"],"names":["router","useRouter","user","useUserStore","bus","useBusStore","notify","useNotifyStore","twofaccounts","useTwofaccounts","qrcodeInput","ref","qrcodeInputLabel","form","reactive","Form","submitQrCode","response","error","capture","onMounted"],"mappings":"orBAOI,MAAMA,EAASC,EAAS,EAClBC,EAAOC,EAAY,EACnBC,EAAMC,EAAW,EACjBC,EAASC,EAAc,EACvBC,EAAeC,EAAe,EAE9BC,EAAcC,EAAI,IAAI,EACtBC,EAAmBD,EAAI,IAAI,EAC3BE,EAAOC,EAAS,IAAIC,EAAK,CAC3B,OAAQ,KACR,YAAa,YACrB,CAAK,CAAC,EAOF,SAASC,GAAe,CACpBH,EAAK,MAAK,EACVA,EAAK,OAASH,EAAY,MAAM,MAAM,CAAC,EAEvCG,EAAK,OAAO,wBAAyB,CAAE,YAAa,GAAM,EAAE,KAAKI,GAAY,CACrEA,EAAS,KAAK,KAAK,MAAM,EAAG,EAAE,EAAE,YAAa,IAAK,qCAClDb,EAAI,aAAea,EAAS,KAAK,KACjCjB,EAAO,KAAK,CAAE,KAAM,gBAAkB,CAAA,IAGtCI,EAAI,WAAaa,EAAS,KAAK,KAC/BjB,EAAO,KAAK,CAAE,KAAM,eAAiB,CAAA,EAE5C,CAAA,EACA,MAAMkB,GAAS,CACRA,EAAM,SAAS,SAAW,KAC1BZ,EAAO,MAAM,CAAE,KAAMY,EAAM,SAAS,KAAK,OAAS,CAAA,CAEzD,CAAA,CACT,CAKI,SAASC,GAAU,CACfnB,EAAO,KAAK,CAAE,KAAM,SAAS,CAAE,CACvC,CAEI,OAAAoB,EAAU,IAAM,CACRlB,EAAK,YAAY,kBAAoBA,EAAK,YAAY,qBAAuB,UAC7EU,EAAiB,MAAM,MAAK,CAEnC,CAAA"} |