{"version":3,"file":"drop_account-admin-settings.mjs","sources":["../src/AdminSettings.vue","../src/admin.js"],"sourcesContent":["<!--\nSPDX-FileCopyrightText: 2021 Framasoft <https://framasoft.org>\nSPDX-FileContributor: Thomas Citharel <thomas.citharel@framasoft.org>\n\nSPDX-License-Identifier: AGPL-3.0-only\n-->\n\n<template>\n\t<NcSettingsSection\n\t\t:name=\"t('drop_account', 'Account deletion')\"\n\t\t:description=\"\n\t\t\tt('drop_account', 'Allows users to delete themselves their own account.')\n\t\t\">\n\t\t<form>\n\t\t\t<fieldset>\n\t\t\t\t<legend>\n\t\t\t\t\t{{ t('drop_account', 'Email confirmation') }}\n\t\t\t\t</legend>\n\t\t\t\t<NcCheckboxRadioSwitch\n\t\t\t\t\t:checked.sync=\"requireConfirmation\"\n\t\t\t\t\t@update:checked=\"toggleRequireConfirmation\">\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{{ t('drop_account', 'Require confirmation by email') }}\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t<em>{{\n\t\t\t\t\t\t\tt(\n\t\t\t\t\t\t\t\t'drop_account',\n\t\t\t\t\t\t\t\t'Will require users to click a confirmation link sent by email to confirm their action.',\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}}</em>\n\t\t\t\t\t</p>\n\t\t\t\t</NcCheckboxRadioSwitch>\n\t\t\t</fieldset>\n\t\t\t<fieldset>\n\t\t\t\t<legend>\n\t\t\t\t\t{{ t('drop_account', 'Data purge') }}\n\t\t\t\t</legend>\n\t\t\t\t<em class=\"fieldset-description\">{{\n\t\t\t\t\tt(\n\t\t\t\t\t\t'drop_account',\n\t\t\t\t\t\t'Users are not removed right away but disabled until a background job removes their data for good. In the meanwhile, admins can \"save\" users by enabling them back.',\n\t\t\t\t\t)\n\t\t\t\t}}</em>\n\t\t\t\t<NcCheckboxRadioSwitch\n\t\t\t\t\t:checked.sync=\"delayPurge\"\n\t\t\t\t\tvalue=\"no\"\n\t\t\t\t\tname=\"drop_account_delay_purge\"\n\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t@update:checked=\"toggleDelayPurge\">\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{{\n\t\t\t\t\t\t\tt('drop_account', 'Purge user data as soon as possible.')\n\t\t\t\t\t\t}}\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t<em>{{\n\t\t\t\t\t\t\tt(\n\t\t\t\t\t\t\t\t'drop_account',\n\t\t\t\t\t\t\t\t\"Uses the next background job available to completely remove the user's data.\",\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}}</em>\n\t\t\t\t\t</p>\n\t\t\t\t</NcCheckboxRadioSwitch>\n\t\t\t\t<NcCheckboxRadioSwitch\n\t\t\t\t\t:checked.sync=\"delayPurge\"\n\t\t\t\t\tvalue=\"yes\"\n\t\t\t\t\tname=\"drop_account_delay_purge\"\n\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t@update:checked=\"toggleDelayPurge\">\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{{ t('drop_account', 'Purge user data after a while.') }}\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t<em>{{\n\t\t\t\t\t\t\tt(\n\t\t\t\t\t\t\t\t'drop_account',\n\t\t\t\t\t\t\t\t'Deletes user data after a grace period.',\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}}</em>\n\t\t\t\t\t</p>\n\t\t\t\t</NcCheckboxRadioSwitch>\n\t\t\t</fieldset>\n\t\t\t<fieldset v-show=\"delayPurge !== 'no'\">\n\t\t\t\t<legend>\n\t\t\t\t\t{{ t('drop_account', 'Grace period duration') }}\n\t\t\t\t</legend>\n\t\t\t\t<select\n\t\t\t\t\tid=\"drop_account_delay_purge_delay\"\n\t\t\t\t\tv-model=\"delayPurgeHours\"\n\t\t\t\t\tname=\"drop_account_delay_purge\"\n\t\t\t\t\tclass=\"select\"\n\t\t\t\t\t:disabled=\"delayPurge === 'no'\"\n\t\t\t\t\t@change=\"changeDelayPurgeHours\">\n\t\t\t\t\t<option value=\"24\">\n\t\t\t\t\t\t{{ t('drop_account', 'One day') }}\n\t\t\t\t\t</option>\n\t\t\t\t\t<option value=\"168\">\n\t\t\t\t\t\t{{ t('drop_account', 'One week') }}\n\t\t\t\t\t</option>\n\t\t\t\t\t<option value=\"720\">\n\t\t\t\t\t\t{{ t('drop_account', 'One month') }}\n\t\t\t\t\t</option>\n\t\t\t\t</select>\n\t\t\t</fieldset>\n\t\t</form>\n\t</NcSettingsSection>\n</template>\n<script>\nimport { loadState } from '@nextcloud/initial-state'\nimport NcSettingsSection from '@nextcloud/vue/dist/Components/NcSettingsSection.js'\nimport NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js'\nimport { showError } from '@nextcloud/dialogs'\n\nexport default {\n\tname: 'AdminSettings',\n\tcomponents: {\n\t\tNcSettingsSection,\n\t\tNcCheckboxRadioSwitch,\n\t},\n\tdata() {\n\t\treturn {\n\t\t\trequireConfirmation: false,\n\t\t\tdelayPurge: 'no',\n\t\t\tdelayPurgeHours: '24',\n\t\t\tappName: 'drop_account',\n\t\t}\n\t},\n\tcreated() {\n\t\ttry {\n\t\t\tthis.requireConfirmation = loadState(this.appName, 'requireConfirmation')\n\t\t\tthis.delayPurge = loadState(this.appName, 'delayPurge')\n\t\t\tthis.delayPurgeHours = loadState(this.appName, 'delayPurgeHours')\n\t\t} catch (e) {\n\t\t\tconsole.error('Error fetching initial state', e)\n\t\t}\n\t},\n\tmethods: {\n\t\ttoggleRequireConfirmation() {\n\t\t\ttry {\n\t\t\t\tthis.OCP.AppConfig.setValue(\n\t\t\t\t\tthis.appName,\n\t\t\t\t\t'requireConfirmation',\n\t\t\t\t\tthis.requireConfirmation ? 'yes' : 'no',\n\t\t\t\t)\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e)\n\t\t\t\tshowError(\n\t\t\t\t\tt(\n\t\t\t\t\t\t'drop_account',\n\t\t\t\t\t\t'Error while changing require confirmation setting',\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\n\t\t},\n\t\ttoggleDelayPurge() {\n\t\t\ttry {\n\t\t\t\tthis.OCP.AppConfig.setValue(\n\t\t\t\t\tthis.appName,\n\t\t\t\t\t'delayPurge',\n\t\t\t\t\tthis.delayPurge,\n\t\t\t\t)\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e)\n\t\t\t\tshowError(\n\t\t\t\t\tt('drop_account', 'Error while changing delay purge setting'),\n\t\t\t\t)\n\t\t\t}\n\t\t},\n\t\tchangeDelayPurgeHours() {\n\t\t\ttry {\n\t\t\t\tthis.OCP.AppConfig.setValue(\n\t\t\t\t\tthis.appName,\n\t\t\t\t\t'delayPurgeHours',\n\t\t\t\t\tthis.delayPurgeHours,\n\t\t\t\t)\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e)\n\t\t\t\tshowError(\n\t\t\t\t\tt(\n\t\t\t\t\t\t'drop_account',\n\t\t\t\t\t\t'Error while changing delay purge hours setting',\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n<style scoped>\nfieldset {\n\tmargin-bottom: 1rem;\n\n\t.fieldset-description {\n\t\tmargin-bottom: 1rem;\n\t\tdisplay: block;\n\t}\n\n\tlegend {\n\t\tfont-size: 1rem;\n\t}\n}\n</style>\n","/**\n * SPDX-FileCopyrightText: 2021 Framasoft <https://framasoft.org>\n * SPDX-FileContributor: Thomas Citharel <thomas.citharel@framasoft.org>\n *\n * SPDX-License-Identifier: AGPL-3.0-only\n */\n\nimport Vue from 'vue'\nimport './common.js'\nimport AdminSettings from './AdminSettings.vue'\n\nexport default new Vue({\n\tel: '#drop-account-settings',\n\trender: (h) => h(AdminSettings),\n})\n"],"names":["_sfc_main","NcSettingsSection","NcCheckboxRadioSwitch","loadState","e","showError","Vue","h","AdminSettings"],"mappings":";oGA+GA,MAAAA,EAAA,CACA,KAAA,gBACA,WAAA,CACA,kBAAAC,EACA,sBAAAC,CACA,EACA,MAAA,CACA,MAAA,CACA,oBAAA,GACA,WAAA,KACA,gBAAA,KACA,QAAA,cACA,CACA,EACA,SAAA,CACA,GAAA,CACA,KAAA,oBAAAC,EAAA,KAAA,QAAA,qBAAA,EACA,KAAA,WAAAA,EAAA,KAAA,QAAA,YAAA,EACA,KAAA,gBAAAA,EAAA,KAAA,QAAA,iBAAA,CACA,OAAAC,EAAA,CACA,QAAA,MAAA,+BAAAA,CAAA,CACA,CACA,EACA,QAAA,CACA,2BAAA,CACA,GAAA,CACA,KAAA,IAAA,UAAA,SACA,KAAA,QACA,sBACA,KAAA,oBAAA,MAAA,IACA,CACA,OAAAA,EAAA,CACA,QAAA,MAAAA,CAAA,EACAC,EACA,EACA,eACA,mDACA,CACA,CACA,CACA,EACA,kBAAA,CACA,GAAA,CACA,KAAA,IAAA,UAAA,SACA,KAAA,QACA,aACA,KAAA,UACA,CACA,OAAAD,EAAA,CACA,QAAA,MAAAA,CAAA,EACAC,EACA,EAAA,eAAA,0CAAA,CACA,CACA,CACA,EACA,uBAAA,CACA,GAAA,CACA,KAAA,IAAA,UAAA,SACA,KAAA,QACA,kBACA,KAAA,eACA,CACA,OAAAD,EAAA,CACA,QAAA,MAAAA,CAAA,EACAC,EACA,EACA,eACA,gDACA,CACA,CACA,CACA,CACA,CACA,ouFC7Ke,IAAIC,EAAI,CACtB,GAAI,yBACJ,OAASC,GAAMA,EAAEC,CAAa,CAC/B,CAAC"}