nextcloud-server/dist/twofactor_backupcodes-setti...

2 lines
6.7 KiB
JavaScript

(()=>{"use strict";var e,o={86912:(e,o,n)=>{var a=n(81222),s=n(85471),c=n(12555),r=n(74095),d=n(88289);const i=(0,n(35947).YK)().detectLogLevel().setApp("twofactor_backupcodes"),l={name:"PersonalSettings",components:{NcButton:r.A,NcLoadingIcon:d.A},data:()=>({generatingCodes:!1}),computed:{downloadUrl(){return this.codes?"data:text/plain,"+encodeURIComponent(this.codes.reduce((t,e)=>t+e+"\r\n","")):""},downloadFilename:()=>(OC.theme.name||"Nextcloud")+"-backup-codes.txt",enabled(){return this.$store.state.enabled},total(){return this.$store.state.total},used(){return this.$store.state.used},codes(){return this.$store.state.codes},name:()=>OC.theme.name||"Nextcloud",haveCodes(){return this.codes&&this.codes.length>0}},methods:{generateBackupCodes(){(0,c.C5)().then(()=>{this.generatingCodes=!0,this.$store.dispatch("generate").then(()=>{this.generatingCodes=!1}).catch(e=>{throw OC.Notification.showTemporary(t("twofactor_backupcodes","An error occurred while generating your backup codes")),this.generatingCodes=!1,e})}).catch(i.error)},getPrintData:t=>t?t.reduce((t,e)=>t+e+"<br>",""):"",printCodes(){!function(e){const o=OC.theme.name||"Nextcloud",n=window.open("",t("twofactor_backupcodes","{name} backup codes",{name:o}));n.document.write("<h1>"+t("twofactor_backupcodes","{name} backup codes",{name:o})+"</h1>"),n.document.write("<pre>"+e+"</pre>"),n.print(),n.close()}(this.getPrintData(this.codes))}}};var u=n(85072),p=n.n(u),b=n(97825),f=n.n(b),g=n(77659),_=n.n(g),h=n(55056),v=n.n(h),A=n(10540),m=n.n(A),k=n(41113),C=n.n(k),w=n(98720),y={};y.styleTagTransform=C(),y.setAttributes=v(),y.insert=_().bind(null,"head"),y.domAPI=f(),y.insertStyleElement=m(),p()(w.A,y),w.A&&w.A.locals&&w.A.locals;const x=(0,n(14486).A)(l,function(){var t=this,e=t._self._c;return e("div",{staticClass:"backupcodes-settings"},[t.enabled?[e("p",{staticClass:"backupcodes-settings__codes"},[t.haveCodes?[t._v("\n\t\t\t\t"+t._s(t.t("twofactor_backupcodes","These are your backup codes. Please save and/or print them as you will not be able to read the codes again later."))+"\n\t\t\t\t"),e("ul",t._l(t.codes,function(o){return e("li",{key:o,staticClass:"backupcodes-settings__codes__code"},[t._v("\n\t\t\t\t\t\t"+t._s(o)+"\n\t\t\t\t\t")])}),0)]:[t._v("\n\t\t\t\t"+t._s(t.t("twofactor_backupcodes","Backup codes have been generated. {used} of {total} codes have been used.",{used:t.used,total:t.total}))+"\n\t\t\t")]],2),t._v(" "),e("p",{staticClass:"backupcodes-settings__actions"},[t.haveCodes?[e("NcButton",{attrs:{href:t.downloadUrl,download:t.downloadFilename,variant:"primary"}},[t._v("\n\t\t\t\t\t"+t._s(t.t("twofactor_backupcodes","Save backup codes"))+"\n\t\t\t\t")]),t._v(" "),e("NcButton",{on:{click:t.printCodes}},[t._v("\n\t\t\t\t\t"+t._s(t.t("twofactor_backupcodes","Print backup codes"))+"\n\t\t\t\t")])]:t._e(),t._v(" "),e("NcButton",{attrs:{id:"generate-backup-codes"},on:{click:t.generateBackupCodes}},[t._v("\n\t\t\t\t"+t._s(t.t("twofactor_backupcodes","Regenerate backup codes"))+"\n\t\t\t")])],2),t._v(" "),e("p",[e("em",[t._v("\n\t\t\t\t"+t._s(t.t("twofactor_backupcodes","If you regenerate backup codes, you automatically invalidate old codes."))+"\n\t\t\t")])])]:e("NcButton",{attrs:{id:"generate-backup-codes",disabled:t.generatingCodes},on:{click:t.generateBackupCodes},scopedSlots:t._u([{key:"icon",fn:function(){return[t.generatingCodes?e("NcLoadingIcon"):t._e()]},proxy:!0}],null,!1,4108280908)},[t._v("\n\t\t"+t._s(t.t("twofactor_backupcodes","Generate backup codes"))+"\n\t")])],2)},[],!1,null,"39bea1ac",null).exports;var O=n(95353),B=n(19051),P=n(63814);s.Ay.use(O.Ay);const N={setEnabled(t,e){s.Ay.set(t,"enabled",e)},setTotal(t,e){s.Ay.set(t,"total",e)},setUsed(t,e){s.Ay.set(t,"used",e)},setCodes(t,e){s.Ay.set(t,"codes",e)}},S={generate:({commit:t})=>(t("setEnabled",!1),function(){const t=(0,P.Jv)("/apps/twofactor_backupcodes/settings/create");return B.Ay.post(t,{}).then(t=>t.data)}().then(({codes:e,state:o})=>(t("setEnabled",o.enabled),t("setTotal",o.total),t("setUsed",o.used),t("setCodes",e),!0)))},T=new O.il({strict:!1,state:{enabled:!1,total:0,used:0,codes:[]},mutations:N,actions:S});s.Ay.prototype.t=t;const j=(0,a.C)("twofactor_backupcodes","state");T.replaceState(j),new(s.Ay.extend(x))({store:T}).$mount("#twofactor-backupcodes-settings")},98720:(t,e,o)=>{o.d(e,{A:()=>r});var n=o(71354),a=o.n(n),s=o(76314),c=o.n(s)()(a());c.push([t.id,".backupcodes-settings__codes__code[data-v-39bea1ac]{font-family:monospace;letter-spacing:.02em;font-size:1.2em}.backupcodes-settings__actions[data-v-39bea1ac]{display:flex;flex-wrap:wrap;align-items:center;gap:var(--default-grid-baseline)}","",{version:3,sources:["webpack://./apps/twofactor_backupcodes/src/views/PersonalSettings.vue"],names:[],mappings:"AAGE,oDACC,qBAAA,CACA,oBAAA,CACA,eAAA,CAIF,gDACC,YAAA,CACA,cAAA,CACA,kBAAA,CACA,gCAAA",sourcesContent:["\n.backupcodes-settings {\n\t&__codes {\n\t\t&__code {\n\t\t\tfont-family: monospace;\n\t\t\tletter-spacing: 0.02em;\n\t\t\tfont-size: 1.2em;\n\t\t}\n\t}\n\n\t&__actions {\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t\talign-items: center;\n\t\tgap: var(--default-grid-baseline);\n\t}\n}\n"],sourceRoot:""}]);const r=c}},n={};function a(t){var e=n[t];if(void 0!==e)return e.exports;var s=n[t]={id:t,loaded:!1,exports:{}};return o[t].call(s.exports,s,s.exports,a),s.loaded=!0,s.exports}a.m=o,e=[],a.O=(t,o,n,s)=>{if(!o){var c=1/0;for(l=0;l<e.length;l++){for(var[o,n,s]=e[l],r=!0,d=0;d<o.length;d++)(!1&s||c>=s)&&Object.keys(a.O).every(t=>a.O[t](o[d]))?o.splice(d--,1):(r=!1,s<c&&(c=s));if(r){e.splice(l--,1);var i=n();void 0!==i&&(t=i)}}return t}s=s||0;for(var l=e.length;l>0&&e[l-1][2]>s;l--)e[l]=e[l-1];e[l]=[o,n,s]},a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var o in e)a.o(e,o)&&!a.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},a.e=()=>Promise.resolve(),a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),a.j=4423,(()=>{a.b="undefined"!=typeof document&&document.baseURI||self.location.href;var t={4423:0};a.O.j=e=>0===t[e];var e=(e,o)=>{var n,s,[c,r,d]=o,i=0;if(c.some(e=>0!==t[e])){for(n in r)a.o(r,n)&&(a.m[n]=r[n]);if(d)var l=d(a)}for(e&&e(o);i<c.length;i++)s=c[i],a.o(t,s)&&t[s]&&t[s][0](),t[s]=0;return a.O(l)},o=self.webpackChunknextcloud=self.webpackChunknextcloud||[];o.forEach(e.bind(null,0)),o.push=e.bind(null,o.push.bind(o))})(),a.nc=void 0;var s=a.O(void 0,[4208],()=>a(86912));s=a.O(s)})();
//# sourceMappingURL=twofactor_backupcodes-settings.js.map?v=cdf5d81465b2260beeae