(()=>{var e,n,o,r={49248:(e,n,o)=>{"use strict";var r=o(32981),i=o(85471),s=o(65043),a=o(67607),c=o(32051),l=o(32073),d=o(88837),p=o(73054),u=o.n(p),f=o(63375),g=o.n(f),m=o(38221),h=o.n(m),y=o(63814);const v={name:"AdminTwoFactor",components:{NcSelect:a.A,NcButton:c.A,NcCheckboxRadioSwitch:l.A,NcSettingsSection:d.A},data:()=>({loading:!1,dirty:!1,groups:[],loadingGroups:!1,twoFactorAdminDoc:(0,r.C)("settings","two-factor-admin-doc")}),computed:{enforced:{get(){return this.$store.state.enforced},set(t){this.dirty=!0,this.$store.commit("setEnforced",t)}},enforcedGroups:{get(){return this.$store.state.enforcedGroups},set(t){this.dirty=!0,this.$store.commit("setEnforcedGroups",t)}},excludedGroups:{get(){return this.$store.state.excludedGroups},set(t){this.dirty=!0,this.$store.commit("setExcludedGroups",t)}}},mounted(){this.groups=u()(g()(this.enforcedGroups.concat(this.excludedGroups))),this.searchGroup("")},methods:{searchGroup:h()((function(t){this.loadingGroups=!0,s.Ay.get((0,y.KT)("cloud/groups?offset=0&search={query}&limit=20",{query:t})).then((t=>t.data.ocs)).then((t=>t.data.groups)).then((t=>{this.groups=u()(g()(this.groups.concat(t)))})).catch((t=>console.error("could not search groups",t))).then((()=>{this.loadingGroups=!1}))}),500),saveChanges(){this.loading=!0;const t={enforced:this.enforced,enforcedGroups:this.enforcedGroups,excludedGroups:this.excludedGroups};s.Ay.put((0,y.Jv)("/settings/api/admin/twofactorauth"),t).then((t=>t.data)).then((t=>{this.state=t,this.dirty=!1})).catch((t=>{console.error("could not save changes",t)})).then((()=>{this.loading=!1}))}}};var b=o(85072),A=o.n(b),w=o(97825),x=o.n(w),C=o(77659),k=o.n(C),E=o(55056),_=o.n(E),N=o(10540),S=o.n(N),G=o(41113),T=o.n(G),O=o(24886),D={};D.styleTagTransform=T(),D.setAttributes=_(),D.insert=k().bind(null,"head"),D.domAPI=x(),D.insertStyleElement=S(),A()(O.A,D),O.A&&O.A.locals&&O.A.locals;var P=o(14486);const M=(0,P.A)(v,(function(){var t=this,e=t._self._c;return e("NcSettingsSection",{attrs:{name:t.t("settings","Two-Factor Authentication"),description:t.t("settings","Two-factor authentication can be enforced for all accounts and specific groups. If they do not have a two-factor provider configured, they will be unable to log into the system."),"doc-url":t.twoFactorAdminDoc}},[t.loading?e("p",[e("span",{staticClass:"icon-loading-small two-factor-loading"}),t._v(" "),e("span",[t._v(t._s(t.t("settings","Enforce two-factor authentication")))])]):e("NcCheckboxRadioSwitch",{attrs:{id:"two-factor-enforced",checked:t.enforced,type:"switch"},on:{"update:checked":function(e){t.enforced=e}}},[t._v("\n\t\t"+t._s(t.t("settings","Enforce two-factor authentication"))+"\n\t")]),t._v(" "),t.enforced?[e("h3",[t._v(t._s(t.t("settings","Limit to groups")))]),t._v("\n\t\t"+t._s(t.t("settings","Enforcement of two-factor authentication can be set for certain groups only."))+"\n\t\t"),e("p",{staticClass:"top-margin"},[t._v("\n\t\t\t"+t._s(t.t("settings","Two-factor authentication is enforced for all members of the following groups."))+"\n\t\t")]),t._v(" "),e("p",[e("label",{attrs:{for:"enforcedGroups"}},[e("span",[t._v(t._s(t.t("settings","Enforced groups")))])]),t._v(" "),e("NcSelect",{attrs:{"input-id":"enforcedGroups",options:t.groups,disabled:t.loading,multiple:!0,loading:t.loadingGroups,"close-on-select":!1},on:{search:t.searchGroup},model:{value:t.enforcedGroups,callback:function(e){t.enforcedGroups=e},expression:"enforcedGroups"}})],1),t._v(" "),e("p",{staticClass:"top-margin"},[t._v("\n\t\t\t"+t._s(t.t("settings","Two-factor authentication is not enforced for members of the following groups."))+"\n\t\t")]),t._v(" "),e("p",[e("label",{attrs:{for:"excludedGroups"}},[e("span",[t._v(t._s(t.t("settings","Excluded groups")))])]),t._v(" "),e("NcSelect",{attrs:{"input-id":"excludedGroups",options:t.groups,disabled:t.loading,multiple:!0,loading:t.loadingGroups,"close-on-select":!1},on:{search:t.searchGroup},model:{value:t.excludedGroups,callback:function(e){t.excludedGroups=e},expression:"excludedGroups"}})],1),t._v(" "),e("p",{staticClass:"top-margin"},[e("em",[t._v("\n\t\t\t\t"+t._s(t.t("settings","When groups are selected/excluded, they use the following logic to determine if an account has 2FA enforced: If no groups are selected, 2FA is enabled for everyone except members of the excluded groups. If groups are selected, 2FA is enabled for all members of these. If an account is both in a selected and excluded group, the selected takes precedence and 2FA is enforced."))+"\n\t\t\t")])])]:t._e(),t._v(" "),e("p",{staticClass:"top-margin"},[t.dirty?e("NcButton",{attrs:{type:"primary",disabled:t.loading},on:{click:t.saveChanges}},[t._v("\n\t\t\t"+t._s(t.t("settings","Save changes"))+"\n\t\t")]):t._e()],1)],2)}),[],!1,null,"32fad389",null).exports;var R=o(85168),B=o(53334),F=o(56760);const I=(0,B.t)("settings","For performance reasons, when you enable encryption on a Nextcloud server only new and changed files are encrypted."),j=(0,o(35947).YK)().setApp("settings").detectUser().build();var U=o(40083),q=o(94219);const $=(0,i.pM)({__name:"EncryptionWarningDialog",emits:["close"],setup(t,e){let{emit:n}=e;const o=[{label:(0,B.t)("settings","Cancel encryption"),type:"tertiary",callback:()=>n("close",!1)},{label:(0,B.t)("settings","Enable encryption"),type:"error",callback:()=>n("close",!0)}];return{__sfc:!0,emit:n,buttons:o,onUpdateOpen:function(t){t||n("close",!1)},t:B.t,textExistingFilesNotEncrypted:I,NcDialog:q.A,NcNoteCard:U.A}}});var W=o(67684),L={};L.styleTagTransform=T(),L.setAttributes=_(),L.insert=k().bind(null,"head"),L.domAPI=x(),L.insertStyleElement=S(),A()(W.A,L),W.A&&W.A.locals&&W.A.locals;const K=(0,P.A)($,(function(){var t=this,e=t._self._c,n=t._self._setupProxy;return e(n.NcDialog,{attrs:{buttons:n.buttons,name:n.t("settings","Confirm enabling encryption"),size:"normal"},on:{"update:open":n.onUpdateOpen}},[e(n.NcNoteCard,{attrs:{type:"warning"}},[e("p",[t._v("\n\t\t\t"+t._s(n.t("settings","Please read carefully before activating server-side encryption:"))+"\n\t\t\t"),e("ul",[e("li",[t._v("\n\t\t\t\t\t"+t._s(n.t("settings","Once encryption is enabled, all files uploaded to the server from that point forward will be encrypted at rest on the server. It will only be possible to disable encryption at a later date if the active encryption module supports that function, and all pre-conditions (e.g. setting a recover key) are met."))+"\n\t\t\t\t")]),t._v(" "),e("li",[t._v("\n\t\t\t\t\t"+t._s(n.t("settings","Encryption alone does not guarantee security of the system. Please see documentation for more information about how the encryption app works, and the supported use cases."))+"\n\t\t\t\t")]),t._v(" "),e("li",[t._v("\n\t\t\t\t\t"+t._s(n.t("settings","Be aware that encryption always increases the file size."))+"\n\t\t\t\t")]),t._v(" "),e("li",[t._v("\n\t\t\t\t\t"+t._s(n.t("settings","It is always good to create regular backups of your data, in case of encryption make sure to backup the encryption keys along with your data."))+"\n\t\t\t\t")]),t._v(" "),e("li",[t._v("\n\t\t\t\t\t"+t._s(n.textExistingFilesNotEncrypted)+"\n\t\t\t\t\t"+t._s(n.t("settings","Refer to the admin documentation on how to manually also encrypt existing files."))+"\n\t\t\t\t")])])])]),t._v(" "),e("p",[t._v("\n\t\t"+t._s(n.t("settings","This is the final warning: Do you really want to enable encryption?"))+"\n\t")])],1)}),[],!1,null,"2565ca49",null).exports,X=(0,i.pM)({__name:"EncryptionSettings",setup(t){const e=(0,r.C)("settings","encryption-modules"),n=Array.isArray(e)?[]:Object.entries(e).map((t=>{let[e,n]=t;return{...n,id:e}})),o=n.find((t=>t.default))?.id,a=(0,r.C)("settings","encryption-ready"),c=(0,r.C)("settings","external-backends-enabled"),p=(0,r.C)("settings","encryption-admin-doc"),u=(0,i.KR)((0,r.C)("settings","encryption-enabled")),f=(0,i.KR)(!1);async function g(t,e){await(0,F.C5)();const n=(0,y.KT)("/apps/provisioning_api/api/v1/config/apps/{appId}/{key}",{appId:"core",key:t});try{const{data:t}=await s.Ay.post(n,{value:e});if("ok"!==t.ocs.meta.status)throw new Error("Unsuccessful OCS response",{cause:t.ocs})}catch(t){return(0,R.Qg)((0,B.t)("settings","Unable to update server side encryption config")),j.error("Unable to update server side encryption config",{error:t}),!1}return!0}async function m(){u.value=await g("encryption_enabled","yes")}return{__sfc:!0,allEncryptionModules:e,encryptionModules:n,defaultCheckedModule:o,encryptionReady:a,externalBackendsEnabled:c,encryptionAdminDoc:p,encryptionEnabled:u,loadingEncryptionState:f,displayWarning:function(t){f.value||!1===t||(f.value=!0,(0,R.Ss)(K,{},(async t=>{try{t&&await m()}finally{f.value=!1}})))},update:g,checkDefaultModule:async function(){o&&await g("default_encryption_module",o)},enableEncryption:m,t:B.t,textExistingFilesNotEncrypted:I,NcCheckboxRadioSwitch:l.A,NcNoteCard:U.A,NcSettingsSection:d.A}}});var z=o(58671),Y={};Y.styleTagTransform=T(),Y.setAttributes=_(),Y.insert=k().bind(null,"head"),Y.domAPI=x(),Y.insertStyleElement=S(),A()(z.A,Y),z.A&&z.A.locals&&z.A.locals;const H=(0,P.A)(X,(function(){var t=this,e=t._self._c,n=t._self._setupProxy;return e(n.NcSettingsSection,{attrs:{name:n.t("settings","Server-side encryption"),description:n.t("settings","Server-side encryption makes it possible to encrypt files which are uploaded to this server. This comes with limitations like a performance penalty, so enable this only if needed."),"doc-url":n.encryptionAdminDoc}},[n.encryptionEnabled?e(n.NcNoteCard,{attrs:{type:"info"}},[e("p",[t._v("\n\t\t\t"+t._s(n.textExistingFilesNotEncrypted)+"\n\t\t\t"+t._s(n.t("settings","To encrypt all existing files run this OCC command:"))+"\n\t\t")]),t._v(" "),e("code",[e("pre",[t._v("occ encryption:encrypt-all")])])]):t._e(),t._v(" "),e(n.NcCheckboxRadioSwitch,{class:{disabled:n.encryptionEnabled},attrs:{checked:n.encryptionEnabled,"aria-disabled":n.encryptionEnabled?"true":void 0,"aria-describedby":n.encryptionEnabled?"server-side-encryption-disable-hint":void 0,loading:n.loadingEncryptionState,type:"switch"},on:{"update:checked":n.displayWarning}},[t._v("\n\t\t"+t._s(n.t("settings","Enable server-side encryption"))+"\n\t")]),t._v(" "),n.encryptionEnabled?e("p",{staticClass:"disable-hint",attrs:{id:"server-side-encryption-disable-hint"}},[t._v("\n\t\t"+t._s(n.t("settings","Disabling server side encryption is only possible using OCC, please refer to the documentation."))+"\n\t")]):t._e(),t._v(" "),0===n.encryptionModules.length?e(n.NcNoteCard,{attrs:{type:"warning",text:n.t("settings","No encryption module loaded, please enable an encryption module in the app menu.")}}):n.encryptionEnabled?[n.encryptionReady&&n.encryptionModules.length>0?e("div",[e("h3",[t._v(t._s(n.t("settings","Select default encryption module:")))]),t._v(" "),e("fieldset",t._l(n.encryptionModules,(function(o){return e(n.NcCheckboxRadioSwitch,{key:o.id,attrs:{checked:n.defaultCheckedModule,value:o.id,type:"radio",name:"default_encryption_module"},on:{"update:checked":[function(t){n.defaultCheckedModule=t},n.checkDefaultModule]}},[t._v("\n\t\t\t\t\t"+t._s(o.displayName)+"\n\t\t\t\t")])})),1)]):n.externalBackendsEnabled?e("div",[t._v("\n\t\t\t"+t._s(n.t("settings",'You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one. Please enable the "Default encryption module" and run {command}',{command:'"occ encryption:migrate"'}))+"\n\t\t")]):t._e()]:t._e()],2)}),[],!1,null,"641ed214",null).exports;var J=o(95353);i.Ay.use(J.Ay);const Q={setEnforced(t,e){i.Ay.set(t,"enforced",e)},setEnforcedGroups(t,e){i.Ay.set(t,"enforcedGroups",e)},setExcludedGroups(t,e){i.Ay.set(t,"excludedGroups",e)}},V=new J.il({strict:!1,state:{enforced:!1,enforcedGroups:[],excludedGroups:[]},mutations:Q});o.nc=btoa(OC.requestToken),i.Ay.prototype.t=t,window.OC=window.OC||{},window.OC.Settings=window.OC.Settings||{},V.replaceState((0,r.C)("settings","mandatory2FAState")),new(i.Ay.extend(M))({store:V}).$mount("#two-factor-auth-settings"),(new(i.Ay.extend(H))).$mount("#vue-admin-encryption")},24886:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var o=n(71354),r=n.n(o),i=n(76314),s=n.n(i)()(r());s.push([t.id,"\n.two-factor-loading[data-v-32fad389] {\n\tdisplay: inline-block;\n\tvertical-align: sub;\n\tmargin-inline: -2px 1px;\n}\n.top-margin[data-v-32fad389] {\n\tmargin-top: 0.5rem;\n}\n","",{version:3,sources:["webpack://./apps/settings/src/components/AdminTwoFactor.vue"],names:[],mappings:";AAyLA;CACA,qBAAA;CACA,mBAAA;CACA,uBAAA;AACA;AAEA;CACA,kBAAA;AACA",sourcesContent:["\x3c!--\n - SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n--\x3e\n\n\n