mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
1 line
No EOL
10 KiB
Text
1 line
No EOL
10 KiB
Text
{"version":3,"file":"encryption-settings_personal.mjs","sources":["../build/frontend/apps/encryption/src/components/SettingsPersonalChangePrivateKey.vue","../build/frontend/apps/encryption/src/components/SettingsPersonalEnableRecovery.vue","../build/frontend/apps/encryption/src/views/SettingsPersonal.vue","../build/frontend/apps/encryption/src/settings-personal.ts"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n -->\n\n<script setup lang=\"ts\">\nimport axios, { isAxiosError } from '@nextcloud/axios'\nimport { showError } from '@nextcloud/dialogs'\nimport { t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcFormGroup, NcNoteCard, NcPasswordField } from '@nextcloud/vue'\nimport { ref, useTemplateRef } from 'vue'\n\ndefineProps<{\n\trecoveryEnabledForUser: boolean\n}>()\n\nconst emit = defineEmits<{\n\tupdated: []\n}>()\n\nconst formElement = useTemplateRef('form')\n\nconst isLoading = ref(false)\nconst hasError = ref(false)\nconst oldPrivateKeyPassword = ref('')\nconst newPrivateKeyPassword = ref('')\n\n/**\n * Handle the form submission to change the private key password\n */\nasync function onSubmit() {\n\tif (isLoading.value) {\n\t\treturn\n\t}\n\n\tisLoading.value = true\n\thasError.value = false\n\ttry {\n\t\tawait axios.post(\n\t\t\tgenerateUrl('/apps/encryption/ajax/updatePrivateKeyPassword'),\n\t\t\t{\n\t\t\t\toldPassword: oldPrivateKeyPassword.value,\n\t\t\t\tnewPassword: newPrivateKeyPassword.value,\n\t\t\t},\n\t\t)\n\t\toldPrivateKeyPassword.value = newPrivateKeyPassword.value = ''\n\t\tformElement.value?.reset()\n\t\temit('updated')\n\t} catch (error) {\n\t\tif (isAxiosError(error) && error.response && error.response.data?.data?.message) {\n\t\t\tshowError(error.response.data.data.message)\n\t\t}\n\t\thasError.value = true\n\t} finally {\n\t\tisLoading.value = false\n\t}\n}\n</script>\n\n<template>\n\t<form ref=\"form\" @submit.prevent=\"onSubmit\">\n\t\t<NcFormGroup\n\t\t\t:label=\"t('encryption', 'Update private key password')\"\n\t\t\t:description=\"t('encryption', 'Your private key password no longer matches your log-in password. Set your old private key password to your current log-in password.')\">\n\t\t\t<NcNoteCard v-if=\"recoveryEnabledForUser\">\n\t\t\t\t{{ t('encryption', 'If you do not remember your old password you can ask your administrator to recover your files.') }}\n\t\t\t</NcNoteCard>\n\n\t\t\t<NcPasswordField :label=\"t('encryption', 'Old log-in password')\" />\n\t\t\t<NcPasswordField :label=\"t('encryption', 'Current log-in password')\" />\n\n\t\t\t<NcButton\n\t\t\t\ttype=\"submit\"\n\t\t\t\tvariant=\"primary\">\n\t\t\t\t{{ t('encryption', 'Update') }}\n\t\t\t</NcButton>\n\t\t</NcFormGroup>\n\t</form>\n</template>\n","<!--\n - SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n -->\n\n<script setup lang=\"ts\">\nimport axios, { isAxiosError } from '@nextcloud/axios'\nimport { showError, showLoading } from '@nextcloud/dialogs'\nimport { t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { watchDebounced } from '@vueuse/core'\nimport { ref, watch } from 'vue'\nimport NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwitch'\n\nconst userEnableRecovery = defineModel<boolean>({ required: true })\nconst isLoading = ref(false)\n\nwatch(userEnableRecovery, () => {\n\tisLoading.value = true\n})\nwatchDebounced([userEnableRecovery], async ([newValue], [oldValue]) => {\n\tif (newValue === oldValue) {\n\t\t// user changed their mind (likely quickly toggled), do nothing\n\t\tisLoading.value = false\n\t\treturn\n\t}\n\n\tconst toast = showLoading(t('encryption', 'Updating recovery keys. This can take some time…'))\n\ttry {\n\t\tawait axios.post(\n\t\t\tgenerateUrl('/apps/encryption/ajax/userSetRecovery'),\n\t\t\t{ userEnableRecovery: userEnableRecovery.value },\n\t\t)\n\t} catch (error) {\n\t\tuserEnableRecovery.value = oldValue\n\t\tif (isAxiosError(error) && error.response && error.response.data?.data?.message) {\n\t\t\tshowError(error.response.data.data.message)\n\t\t}\n\t} finally {\n\t\ttoast.hideToast()\n\t\tisLoading.value = false\n\t}\n}, { debounce: 800 })\n</script>\n\n<template>\n\t<NcCheckboxRadioSwitch\n\t\tv-model=\"userEnableRecovery\"\n\t\ttype=\"switch\"\n\t\t:loading=\"isLoading\"\n\t\t:description=\"t('encryption', 'Enabling this option will allow you to reobtain access to your encrypted files in case of password loss')\">\n\t\t{{ t('encryption', 'Enable password recovery') }}\n\t</NcCheckboxRadioSwitch>\n</template>\n","<!--\n - SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n -->\n\n<script setup lang=\"ts\">\nimport axios from '@nextcloud/axios'\nimport { showInfo } from '@nextcloud/dialogs'\nimport { loadState } from '@nextcloud/initial-state'\nimport { t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { ref } from 'vue'\nimport NcNoteCard from '@nextcloud/vue/components/NcNoteCard'\nimport NcSettingsSection from '@nextcloud/vue/components/NcSettingsSection'\nimport SettingsPersonalChangePrivateKey from '../components/SettingsPersonalChangePrivateKey.vue'\nimport SettingsPersonalEnableRecovery from '../components/SettingsPersonalEnableRecovery.vue'\nimport { logger } from '../utils/logger.ts'\nimport { InitStatus } from '../utils/types.ts'\n\nconst personalSettings = loadState<{\n\trecoveryEnabled: boolean\n\trecoveryEnabledForUser: boolean\n\tprivateKeySet: boolean\n\tinitialized: typeof InitStatus[keyof typeof InitStatus]\n}>('encryption', 'personalSettings')\n\nconst initialized = ref(personalSettings.initialized)\nconst recoveryEnabledForUser = ref(personalSettings.recoveryEnabledForUser)\n\n/**\n * Reload encryption status\n */\nasync function reloadStatus() {\n\ttry {\n\t\tconst { data } = await axios.get(generateUrl('/apps/encryption/ajax/getStatus'))\n\t\tinitialized.value = data.initStatus\n\t\tif (data.data.message) {\n\t\t\tshowInfo(data.data.message)\n\t\t}\n\t} catch (error) {\n\t\tlogger.error('Failed to fetch current encryption status', { error })\n\t}\n}\n</script>\n\n<template>\n\t<NcSettingsSection :name=\"t('encryption', 'Basic encryption module')\">\n\t\t<NcNoteCard v-if=\"initialized === InitStatus.NotInitialized\" type=\"warning\">\n\t\t\t{{ t('encryption', 'Encryption app is enabled but your keys are not initialized, please log-out and log-in again') }}\n\t\t</NcNoteCard>\n\n\t\t<SettingsPersonalChangePrivateKey\n\t\t\tv-else-if=\"initialized === InitStatus.InitExecuted\"\n\t\t\t:recovery-enabled-for-user\n\t\t\t@updated=\"reloadStatus\" />\n\t\t<SettingsPersonalEnableRecovery\n\t\t\tv-else-if=\"personalSettings.recoveryEnabled && personalSettings.privateKeySet\"\n\t\t\tv-model=\"recoveryEnabledForUser\" />\n\t</NcSettingsSection>\n</template>\n","/*!\n * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { createApp } from 'vue'\nimport SettingsPersonal from './views/SettingsPersonal.vue'\n\nconst app = createApp(SettingsPersonal)\napp.mount('#encryption-settings-section')\n"],"names":["emit","__emit","formElement","useTemplateRef","isLoading","ref","hasError","oldPrivateKeyPassword","newPrivateKeyPassword","onSubmit","axios","generateUrl","error","isAxiosError","showError","_createElementBlock","_createVNode","_unref","NcFormGroup","t","__props","_createBlock","NcNoteCard","NcPasswordField","NcButton","userEnableRecovery","_useModel","watch","watchDebounced","newValue","oldValue","toast","showLoading","NcCheckboxRadioSwitch","$event","personalSettings","loadState","initialized","recoveryEnabledForUser","reloadStatus","data","showInfo","logger","NcSettingsSection","InitStatus","SettingsPersonalChangePrivateKey","SettingsPersonalEnableRecovery","app","createApp","SettingsPersonal"],"mappings":"+xDAiBA,MAAMA,EAAO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