mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-01-05 22:09:52 +01:00
1 line
6.7 KiB
Plaintext
1 line
6.7 KiB
Plaintext
|
{"version":3,"file":"Auth-C7Y7ObbO.js","sources":["../../../resources/js/views/admin/Auth.vue"],"sourcesContent":["<script setup>\n import AdminTabs from '@/layouts/AdminTabs.vue'\n import appSettingService from '@/services/appSettingService'\n import { useAppSettingsUpdater } from '@/composables/appSettingsUpdater'\n import { useAppSettingsStore } from '@/stores/appSettings'\n import { useNotifyStore } from '@/stores/notify'\n\n const $2fauth = inject('2fauth')\n const notify = useNotifyStore()\n const appSettings = useAppSettingsStore()\n const returnTo = useStorage($2fauth.prefix + 'returnTo', 'accounts')\n\n const fieldErrors = ref({\n restrictList: null,\n restrictRule: null,\n })\n\n /**\n * Saves a setting on the backend\n * \n * @param {string} preference \n * @param {any} value \n */\n // async function saveSetting(setting, value) {\n\n // }\n\n /**\n * Saves or deletes a setting on the backend\n * \n * @param {string} preference \n * @param {any} value \n */\n async function saveOrDeleteSetting(setting, value) {\n fieldErrors.value[setting] = null\n\n // restrictRule and RestrictList may be empty if the admin decides to not use them.\n // As an app setting cannot be set with an empty string (the 'value' field in the 'Options'\n // table is not NULLABLE), we 'delete' the appSetting instead of updating it.\n if (value == '') {\n appSettingService.delete(setting, { returnError: true }).then(response => {\n appSettings[setting] = ''\n notify.success({ type: 'is-success', text: trans('settings.forms.setting_saved') })\n })\n .catch(error => {\n if( error.response.status !== 404 ) {\n notify.error(error);\n }\n })\n }\n else {\n const { error } = await useAppSettingsUpdater(setting, value, true)\n\n if( error ) {\n fieldErrors.value[setting] = error.response.data.message\n }\n }\n }\n\n onBeforeRouteLeave((to) => {\n if (! to.name.startsWith('admin.')) {\n notify.clear()\n }\n })\n\n onMounted(async () => {\n await appSettings.fetch()\n })\n\n</script>\n\n<template>\n <div>\n <AdminTabs activeTab=\"admin.auth\" />\n <div class=\"options-tabs\">\n <FormWrapper>\n <form>\n <h4 class=\"title is-4 pt-4 has-text-grey-light\">{{ $t('admin.single_sign_on') }}</h4>\n <!-- enable SSO -->\n <FormCheckbox v-model=\"appSettings.enableSso\" @update:model-value=\"val => useAppSettingsUpdater('enableSso', val)\" fieldName=\"enableSso\" label=\"admin.forms.enable_sso.label\" help=\"admin.forms.enable_sso.help\" />\n <!-- use SSO only -->\n <FormCheckbox v-model=\"appSettings.useSsoOnly\" @update:model-value=\"val => useAppSettingsUpdater('useSsoOnly', val)\" fieldName=\"useSsoOnly\" label=\"admin.forms.use_sso_only.label\" help=\"admin.forms.use_sso_only.help\" :isDisabled=\"!appSettings.enableSso\" :isIndented=\"true\" />\n <h4 class=\"title is-4 pt-4 has-text-grey-light\">{{ $t('admin.registrations') }}</h4>\n <!-- restrict registration -->\n <FormCheckbox v-model=\"appSettings.restrictRegistration\" @update:model-value=\"val => useAppSettingsUpdater('restrictRegistration', val)\" fieldName=\"restrictRegistration\" :isDisabled=\"appSettings.disableRegistration\" label=\"admin.forms.restrict_registration.label\" help=\"admin.forms.restrict_registration.help\" />\n <!-- restrict list -->\n <FormField v-model=\"appSettings.restrictList\" @change:model-value=\"val => saveOrDeleteSetting('restrictList', val)\" :fieldError=\"fieldErrors.restrictList\" fieldName=\"restrictList\" :isDisabled=\"!appSettings.restrictRegistrati
|