mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-11 09:40:43 +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.restrictRegistration || appSettings.disableRegistration\" label=\"admin.forms.restrict_list.label\" help=\"admin.forms.restrict_list.help\" :isIndented=\"true\" />\n <!-- restrict rule -->\n <FormField v-model=\"appSettings.restrictRule\" @change:model-value=\"val => saveOrDeleteSetting('restrictRule', val)\" :fieldError=\"fieldErrors.restrictRule\" fieldName=\"restrictRule\" :isDisabled=\"!appSettings.restrictRegistration || appSettings.disableRegistration\" label=\"admin.forms.restrict_rule.label\" help=\"admin.forms.restrict_rule.help\" :isIndented=\"true\" leftIcon=\"slash\" rightIcon=\"slash\" />\n <!-- disable registration -->\n <FormCheckbox v-model=\"appSettings.disableRegistration\" @update:model-value=\"val => useAppSettingsUpdater('disableRegistration', val)\" fieldName=\"disableRegistration\" label=\"admin.forms.disable_registration.label\" help=\"admin.forms.disable_registration.help\" />\n <!-- keep sso registration -->\n <FormCheckbox v-model=\"appSettings.keepSsoRegistrationEnabled\" @update:model-value=\"val => useAppSettingsUpdater('keepSsoRegistrationEnabled', val)\" fieldName=\"keepSsoRegistrationEnabled\" :isDisabled=\"!appSettings.enableSso || !appSettings.disableRegistration\" label=\"admin.forms.keep_sso_registration_enabled.label\" help=\"admin.forms.keep_sso_registration_enabled.help\" :isIndented=\"true\" />\n </form>\n </FormWrapper>\n </div>\n <VueFooter :showButtons=\"true\">\n <ButtonBackCloseCancel :returnTo=\"{ name: returnTo }\" action=\"close\" />\n </VueFooter>\n </div>\n</template>\n"],"names":["$2fauth","inject","notify","useNotifyStore","appSettings","useAppSettingsStore","returnTo","useStorage","fieldErrors","ref","saveOrDeleteSetting","setting","value","appSettingService","response","trans","error","useAppSettingsUpdater","onBeforeRouteLeave","to","onMounted"],"mappings":"2eAOI,MAAMA,EAAUC,EAAO,QAAQ,EACzBC,EAASC,EAAc,EACvBC,EAAcC,EAAmB,EACjCC,EAAWC,EAAWP,EAAQ,OAAS,WAAY,UAAU,EAE7DQ,EAAcC,EAAI,CACpB,aAAc,KACd,aAAc,IACjB,CAAA,EAkBD,eAAeC,EAAoBC,EAASC,EAAO,CAM/C,GALAJ,EAAY,MAAMG,CAAO,EAAI,KAKzBC,GAAS,GACTC,EAAkB,OAAOF,EAAS,CAAE,YAAa,GAAM,EAAE,KAAKG,GAAY,CACtEV,EAAYO,CAAO,EAAI,GACvBT,EAAO,QAAQ,CAAE,KAAM,aAAc,KAAMa,EAAM,8BAA8B,CAAG,CAAA,CACrF,CAAA,EACA,MAAMC,GAAS,CACRA,EAAM,SAAS,SAAW,KAC1Bd,EAAO,MAAMc,CAAK,CAEzB,CAAA,MAEA,CACD,KAAM,CAAE,MAAAA,CAAK,EAAK,MAAMC,EAAsBN,EAASC,EAAO,EAAI,EAE9DI,IACAR,EAAY,MAAMG,CAAO,EAAIK,EAAM,SAAS,KAAK,QAEjE,CACA,CAEI,OAAAE,EAAoBC,GAAO,CACjBA,EAAG,KAAK,WAAW,QAAQ,GAC7BjB,EAAO,MAAK,CAEnB,CAAA,EAEDkB,EAAU,SAAY,CAClB,MAAMhB,EAAY,MAAK,CAC1B,CAAA"} |