File: /home/nepi/www/public/admin/js/setup-2fa.eec2bf13.js.map
{"version":3,"sources":["webpack:///./src/routes/setup-2fa.vue?d7b7","webpack:///src/routes/setup-2fa.vue","webpack:///./src/routes/setup-2fa.vue?8a4d","webpack:///./src/routes/setup-2fa.vue","webpack:///./src/routes/setup-2fa.vue?0b84","webpack:///./src/routes/setup-2fa.vue?8730"],"names":["render","_vm","this","_h","$createElement","_c","_self","attrs","$t","finished","fetchingData","_e","_v","tfa_secret","staticClass","totpUrl","width","on","save2faSecret","enterApp","saving","slot","_s","error","staticRenderFns","component"],"mappings":"kHAAA,IAAIA,EAAS,WAAa,IAAIC,EAAIC,KAASC,EAAGF,EAAIG,eAAmBC,EAAGJ,EAAIK,MAAMD,IAAIF,EAAG,OAAOE,EAAG,aAAa,CAACE,MAAM,CAAC,QAAUN,EAAIO,GAAG,eAAe,EAAmB,IAAjBP,EAAIQ,UAAuBR,EAAIS,aAA8TT,EAAIU,KAApT,CAACN,EAAG,IAAI,CAACJ,EAAIW,GAAG,sHAAwHX,EAAIY,WAA4BR,EAAG,UAAU,CAACS,YAAY,KAAKP,MAAM,CAAC,MAAQN,EAAIc,QAAQ,QAAU,CAAEC,MAAO,QAA7FX,EAAG,aAAmGA,EAAG,YAAY,CAACY,GAAG,CAAC,MAAQhB,EAAIiB,mBAA6C,IAAjBjB,EAAIQ,UAAsBR,EAAIS,aAAgNT,EAAIU,KAAtM,CAACN,EAAG,IAAI,CAACJ,EAAIW,GAAG,2FAA2FP,EAAG,SAAS,CAACE,MAAM,CAAC,KAAO,UAAUU,GAAG,CAAC,MAAQhB,EAAIkB,WAAW,CAAClB,EAAIW,GAAG,eAAyBX,EAAImB,QAAUnB,EAAIS,aAAcL,EAAG,oBAAoB,CAACS,YAAY,UAAUP,MAAM,CAAC,cAAgB,GAAG,QAAU,MAAMN,EAAIU,KAAMV,EAAS,MAAEI,EAAG,gBAAgB,CAACE,MAAM,CAAC,KAAO,SAAS,MAAQ,UAAUc,KAAK,UAAU,CAACpB,EAAIW,GAAG,IAAIX,EAAIqB,GAAGrB,EAAIO,GAAI,UAAaP,EAAIsB,MAAU,OAAK,OAAOtB,EAAIU,MAAM,IAC1hCa,EAAkB,G,ixBCkCtB,OACA,gBACA,YACA,kBACA,oBACA,WACA,iBAEA,KARA,WASA,OACA,gBACA,WACA,YACA,UACA,kBAGA,cACA,oDADA,CAEA,QAFA,WAGA,sIAGA,QAvBA,WAwBA,uBAEA,SACA,eADA,WACA,8KACA,oCADA,OACA,EADA,OAEA,kCAFA,8CAIA,cALA,SAKA,0KACA,YADA,sBAGA,2BAHA,uBAIA,GAFA,EAFA,oBAQA,4CARA,OASA,cATA,mDAWA,aACA,oBAZA,yBAcA,YAdA,+EAiBA,SAtBA,WAsBA,qKACA,kBADA,SAIA,iBAJA,OAOA,EAPA,WAOA,oBAPA,gBAUA,uCACA,wCAIA,0BACA,2BAGA,6BAGA,qBAtBA,gDCnFmV,I,kCCS/UC,EAAY,eACd,EACAzB,EACAwB,GACA,EACA,KACA,WACA,MAIa,aAAAC,E,2FCpBf,yBAAsiB,EAAG,G,kCCAziB,yBAA8gB,EAAG","file":"js/setup-2fa.eec2bf13.js","sourcesContent":["var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('PublicView',{attrs:{\"heading\":_vm.$t('setup_2fa')}},[(_vm.finished === false && !_vm.fetchingData)?[_c('p',[_vm._v(\" Scan this QR code with your authenticator app, then enter the verification code it provides to complete setup. \")]),(!_vm.tfa_secret)?_c('v-spinner'):_c('qr-code',{staticClass:\"qr\",attrs:{\"value\":_vm.totpUrl,\"options\":{ width: 340 }}}),_c('otp-input',{on:{\"input\":_vm.save2faSecret}})]:_vm._e(),(_vm.finished === true && !_vm.fetchingData)?[_c('p',[_vm._v(\" Congratulations! You have successfully set up 2-factor authentication for Directus. \")]),_c('button',{attrs:{\"type\":\"button\"},on:{\"click\":_vm.enterApp}},[_vm._v(\"Continue\")])]:_vm._e(),(_vm.saving || _vm.fetchingData)?_c('v-progress-linear',{staticClass:\"loading\",attrs:{\"indeterminate\":\"\",\"rounded\":\"\"}}):_vm._e(),(_vm.error)?_c('public-notice',{attrs:{\"slot\":\"notice\",\"color\":\"danger\"},slot:\"notice\"},[_vm._v(\" \"+_vm._s(_vm.$t((\"errors.\" + (_vm.error.code))))+\" \")]):_vm._e()],2)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n\t<PublicView :heading=\"$t('setup_2fa')\">\n\t\t<template v-if=\"finished === false && !fetchingData\">\n\t\t\t<!-- <h2 class=\"type-title\">Scan the QR Code</h2> -->\n\t\t\t<p>\n\t\t\t\tScan this QR code with your authenticator app, then enter the verification code it\n\t\t\t\tprovides to complete setup.\n\t\t\t</p>\n\t\t\t<v-spinner v-if=\"!tfa_secret\" />\n\t\t\t<qr-code v-else class=\"qr\" :value=\"totpUrl\" :options=\"{ width: 340 }\" />\n\t\t\t<otp-input @input=\"save2faSecret\" />\n\t\t</template>\n\t\t<template v-if=\"finished === true && !fetchingData\">\n\t\t\t<p>\n\t\t\t\tCongratulations! You have successfully set up 2-factor authentication for Directus.\n\t\t\t</p>\n\t\t\t<button type=\"button\" @click=\"enterApp\">Continue</button>\n\t\t</template>\n\t\t<v-progress-linear v-if=\"saving || fetchingData\" class=\"loading\" indeterminate rounded />\n\t\t<public-notice v-if=\"error\" slot=\"notice\" color=\"danger\">\n\t\t\t{{ $t(`errors.${error.code}`) }}\n\t\t</public-notice>\n\t</PublicView>\n</template>\n\n<script>\nimport PublicView from '@/components/public-view';\nimport PublicNotice from '@/components/public/notice';\nimport QrCode from '@chenfengyuan/vue-qrcode';\nimport { mapState } from 'vuex';\nimport OtpInput from '@/components/public/otp-input';\nimport hydrateStore from '@/hydrate';\n\n// NOTE: We'll have to use tfa instead of 2fa in JavaScript. Variables can't start with a number\n\nexport default {\n\tname: 'Setup2FA',\n\tcomponents: {\n\t\tPublicView,\n\t\tPublicNotice,\n\t\tQrCode,\n\t\tOtpInput\n\t},\n\tdata() {\n\t\treturn {\n\t\t\ttfa_secret: null,\n\t\t\terror: null,\n\t\t\tfinished: false,\n\t\t\tsaving: false,\n\t\t\tfetchingData: false\n\t\t};\n\t},\n\tcomputed: {\n\t\t...mapState(['apiRootPath', 'currentProjectKey']),\n\t\ttotpUrl() {\n\t\t\treturn `otpauth://totp/Directus:${this.$store.state.currentUser.email}?secret=${this.tfa_secret}&issuer=Directus`;\n\t\t}\n\t},\n\tcreated() {\n\t\tthis.fetch2faSecret();\n\t},\n\tmethods: {\n\t\tasync fetch2faSecret() {\n\t\t\tconst response = await this.$api.api.get('/utils/2fa_secret');\n\t\t\tthis.tfa_secret = response.data['2fa_secret'];\n\t\t},\n\t\tasync save2faSecret(otp) {\n\t\t\tthis.saving = true;\n\t\t\tconst body = {\n\t\t\t\t['2fa_secret']: this.tfa_secret,\n\t\t\t\totp: otp\n\t\t\t};\n\n\t\t\ttry {\n\t\t\t\tawait this.$api.api.post('/users/me/activate_2fa', body);\n\t\t\t\tthis.finished = true;\n\t\t\t} catch (error) {\n\t\t\t\tthis.error = error;\n\t\t\t\tconsole.error(error);\n\t\t\t} finally {\n\t\t\t\tthis.saving = false;\n\t\t\t}\n\t\t},\n\t\tasync enterApp() {\n\t\t\tthis.fetchingData = true;\n\n\t\t\t// This will fetch all the needed information about the project in order to run Directus\n\t\t\tawait hydrateStore();\n\n\t\t\t// Default to /collections as homepage\n\t\t\tlet route = `/${this.currentProjectKey}/collections`;\n\n\t\t\t// If the last visited page is saved in the current user record, use that\n\t\t\tif (this.$store.state.currentUser.last_page) {\n\t\t\t\troute = this.$store.state.currentUser.last_page;\n\t\t\t}\n\n\t\t\t// In the case the URL contains a redirect query, use that instead\n\t\t\tif (this.$route.query.redirect) {\n\t\t\t\troute = this.$route.query.redirect;\n\t\t\t}\n\n\t\t\tthis.$router.push(route, () => {\n\t\t\t\t// We only set the fetchingData flag to false when the page navigation is done\n\t\t\t\t// This makes sure we don't show a flash of \"authenticated\" style login view\n\t\t\t\tthis.fetchingData = false;\n\t\t\t});\n\t\t}\n\t}\n};\n</script>\n\n<style lang=\"scss\">\n.qr {\n\tmargin-bottom: 32px;\n\tborder: var(--input-border-width) solid var(--input-border-color);\n\tborder-radius: var(--border-radius);\n}\n</style>\n\n<style lang=\"scss\" scoped>\np {\n\tfont-size: 16px;\n\tline-height: 26px;\n\tmargin-top: 32px;\n\tmargin-bottom: 32px;\n\tcolor: var(--blue-grey-300);\n}\n\n.loading {\n\tmargin-top: 32px;\n\tmargin-bottom: 32px;\n}\n\n.button,\nbutton {\n\tposition: relative;\n\tbackground-color: var(--button-primary-background-color);\n\tborder: 2px solid var(--button-primary-background-color);\n\tborder-radius: var(--border-radius);\n\tcolor: var(--button-primary-text-color);\n\theight: 60px;\n\tpadding: 18px 20px;\n\twidth: 100%;\n\tmax-width: 154px;\n\tfont-size: 16px;\n\tfont-weight: 400;\n\ttransition: background-color var(--fast) var(--transition);\n\tdisplay: inline-block;\n\ttext-decoration: none;\n\ttext-align: center;\n\n\t&[disabled] {\n\t\tcursor: not-allowed;\n\t}\n\n\t&:not([disabled]) {\n\t\t&:hover {\n\t\t\tbackground-color: var(--darkest-gray);\n\t\t\tborder-color: var(--darkest-gray);\n\t\t}\n\t}\n\n\t&.outline {\n\t\tbackground-color: transparent;\n\t\tcolor: var(--darkest-gray);\n\n\t\t&[disabled] {\n\t\t\tbackground-color: transparent;\n\t\t}\n\n\t\t&:not([disabled]) {\n\t\t\t&:hover {\n\t\t\t\tbackground-color: transparent;\n\t\t\t}\n\t\t}\n\t}\n}\n</style>\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./setup-2fa.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./setup-2fa.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./setup-2fa.vue?vue&type=template&id=2379f7ec&scoped=true&\"\nimport script from \"./setup-2fa.vue?vue&type=script&lang=js&\"\nexport * from \"./setup-2fa.vue?vue&type=script&lang=js&\"\nimport style0 from \"./setup-2fa.vue?vue&type=style&index=0&lang=scss&\"\nimport style1 from \"./setup-2fa.vue?vue&type=style&index=1&id=2379f7ec&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"2379f7ec\",\n null\n \n)\n\nexport default component.exports","import mod from \"-!../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./setup-2fa.vue?vue&type=style&index=1&id=2379f7ec&lang=scss&scoped=true&\"; export default mod; export * from \"-!../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./setup-2fa.vue?vue&type=style&index=1&id=2379f7ec&lang=scss&scoped=true&\"","import mod from \"-!../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./setup-2fa.vue?vue&type=style&index=0&lang=scss&\"; export default mod; export * from \"-!../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./setup-2fa.vue?vue&type=style&index=0&lang=scss&\""],"sourceRoot":""}