mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-03 22:01:45 +01:00
1 line
10 KiB
Plaintext
1 line
10 KiB
Plaintext
{"version":3,"file":"Account-CPg75o3J.js","sources":["../../../resources/js/views/settings/Account.vue"],"sourcesContent":["<script setup>\n import Form from '@/components/formElements/Form'\n import SettingTabs from '@/layouts/SettingTabs.vue'\n import { useUserStore } from '@/stores/user'\n import { useNotifyStore } from '@/stores/notify'\n\n const $2fauth = inject('2fauth')\n const user = useUserStore()\n const notify = useNotifyStore()\n const router = useRouter()\n const returnTo = useStorage($2fauth.prefix + 'returnTo', 'accounts')\n \n const formProfile = reactive(new Form({\n name : user.name,\n email : user.email,\n password : '',\n }))\n const formPassword = reactive(new Form({\n currentPassword : '',\n password : '',\n password_confirmation : '',\n }))\n const formDelete = reactive(new Form({\n password : '',\n }))\n\n /**\n * submit user profile changes\n */\n function submitProfile(e) {\n\n formProfile.put('/user', {returnError: true})\n .then(response => {\n user.$patch({\n name: response.data.name,\n email: response.data.email,\n isAdmin: response.data.is_admin,\n })\n notify.success({ text: trans('auth.forms.profile_saved') })\n })\n .catch(error => {\n if( error.response.status === 400 ) {\n notify.alert({ text: error.response.data.message })\n }\n else if( error.response.status !== 422 ) {\n notify.error(error.response)\n }\n })\n }\n\n /**\n * submit password change\n */\n function submitPassword(e) {\n\n formPassword.patch('/user/password', {returnError: true})\n .then(response => {\n formPassword.password = ''\n formPassword.formPassword = ''\n formPassword.password_confirmation = ''\n notify.success({ text: response.data.message })\n })\n .catch(error => {\n if( error.response.status === 400 ) {\n notify.alert({ text: error.response.data.message })\n }\n else if( error.response.status !== 422 ) {\n notify.error(error.response)\n }\n })\n }\n\n /**\n * submit user account deletion\n */\n function submitDelete(e) {\n\n if(confirm(trans('auth.confirm.delete_account'))) {\n formDelete.delete('/user', {returnError: true})\n .then(response => {\n notify.success({ text: trans('auth.forms.user_account_successfully_deleted') })\n router.push({ name: 'register' });\n })\n .catch(error => {\n if( error.response.status === 400 ) {\n notify.alert({ text: error.response.data.message })\n }\n else if( error.response.status !== 422 ) {\n notify.error(error.response)\n }\n })\n }\n }\n\n onBeforeRouteLeave((to) => {\n if (! to.name.startsWith('settings.') && to.name === 'login') {\n notify.clear()\n }\n })\n</script>\n\n<template>\n <div>\n <SettingTabs :activeTab=\"'settings.account'\" />\n <div class=\"options-tabs\">\n <FormWrapper>\n <div v-if=\"user.isAdmin\" class=\"notification is-warning\">\n {{ $t('settings.you_are_administrator') }}\n </div>\n <div v-if=\"user.oauth_provider\" class=\"notification is-info has-text-centered\">\n {{ $t('settings.account_linked_to_sso_x_provider', { provider: user.oauth_provider }) }}\n </div>\n <form @submit.prevent=\"submitProfile\" @keydown=\"formProfile.onKeydown($event)\">\n <div v-if=\"$2fauth.config.proxyAuth\" class=\"notification is-warning has-text-centered\" v-html=\"$t('auth.user_account_controlled_by_proxy')\" />\n <h4 class=\"title is-4 has-text-grey-light\">{{ $t('settings.profile') }}</h4>\n <fieldset :disabled=\"$2fauth.config.proxyAuth || user.oauth_provider\">\n <FormField v-model=\"formProfile.name\" fieldName=\"name\" :fieldError=\"formProfile.errors.get('name')\" label=\"auth.forms.name\" :maxLength=\"255\" autocomplete=\"username\" autofocus />\n <FormField v-model=\"formProfile.email\" fieldName=\"email\" :fieldError=\"formProfile.errors.get('email')\" inputType=\"email\" label=\"auth.forms.email\" autocomplete=\"email\" :maxLength=\"255\" autofocus />\n <FormField v-model=\"formProfile.password\" fieldName=\"password\" :fieldError=\"formProfile.errors.get('password')\" inputType=\"password\" label=\"auth.forms.current_password.label\" autocomplete=\"current-password\" help=\"auth.forms.current_password.help\" />\n <FormButtons :isBusy=\"formProfile.isBusy\" caption=\"commons.update\" />\n </fieldset>\n </form>\n <form @submit.prevent=\"submitPassword\" @keydown=\"formPassword.onKeydown($event)\">\n <input hidden type=\"text\" name=\"name\" :value=\"formProfile.name\" autocomplete=\"username\" />\n <input hidden type=\"text\" name=\"email\" :value=\"formProfile.email\" autocomplete=\"email\" />\n <h4 class=\"title is-4 pt-6 has-text-grey-light\">{{ $t('settings.change_password') }}</h4>\n <fieldset :disabled=\"$2fauth.config.proxyAuth || user.oauth_provider\">\n <FormPasswordField v-model=\"formPassword.password\" fieldName=\"password\" :fieldError=\"formPassword.errors.get('password')\" idSuffix=\"ForUpdate\" autocomplete=\"new-password\" :showRules=\"true\" label=\"auth.forms.new_password\" />\n <FormPasswordField v-model=\"formPassword.password_confirmation\" :showRules=\"false\" fieldName=\"password_confirmation\" :fieldError=\"formPassword.errors.get('password_confirmation')\" inputType=\"password\" autocomplete=\"new-password\" label=\"auth.forms.confirm_new_password\" />\n <FormField v-model=\"formPassword.currentPassword\" fieldName=\"currentPassword\" :fieldError=\"formPassword.errors.get('currentPassword')\" inputType=\"password\" label=\"auth.forms.current_password.label\" autocomplete=\"current-password\" help=\"auth.forms.current_password.help\" />\n <FormButtons :isBusy=\"formPassword.isBusy\" submitId=\"btnSubmitChangePwd\" caption=\"auth.forms.change_password\" />\n </fieldset>\n </form>\n <form id=\"frmDeleteAccount\" @submit.prevent=\"submitDelete\" @keydown=\"formDelete.onKeydown($event)\">\n <input hidden type=\"text\" name=\"name\" :value=\"formProfile.name\" autocomplete=\"username\" />\n <input hidden type=\"text\" name=\"email\" :value=\"formProfile.email\" autocomplete=\"email\" />\n <h4 class=\"title is-4 pt-6 has-text-danger\">{{ $t('auth.forms.delete_account') }}</h4>\n <div class=\"field is-size-7-mobile\">\n <p class=\"block\">{{ $t('auth.forms.delete_your_account_and_reset_all_data')}}</p>\n <p>{{ $t('auth.forms.reset_your_password_to_delete_your_account') }}</p>\n <p>{{ $t('auth.forms.deleting_2fauth_account_does_not_impact_provider') }}</p>\n </div>\n <fieldset :disabled=\"$2fauth.config.proxyAuth\">\n <FormField v-model=\"formDelete.password\" fieldName=\"password\" :fieldError=\"formDelete.errors.get('password')\" inputType=\"password\" idSuffix=\"ForDelete\" autocomplete=\"new-password\" label=\"auth.forms.current_password.label\" help=\"auth.forms.current_password.help\" />\n <FormButtons :isBusy=\"formDelete.isBusy\" caption=\"auth.forms.delete_your_account\" submitId=\"btnDeleteAccount\" color=\"is-danger\" />\n </fieldset>\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","user","useUserStore","notify","useNotifyStore","router","useRouter","returnTo","useStorage","formProfile","reactive","Form","formPassword","formDelete","submitProfile","e","response","trans","error","submitPassword","submitDelete","onBeforeRouteLeave","to"],"mappings":"wxBAMI,MAAMA,EAAUC,EAAO,QAAQ,EACzBC,EAAOC,EAAY,EACnBC,EAASC,EAAc,EACvBC,EAASC,EAAS,EAClBC,EAAWC,EAAWT,EAAQ,OAAS,WAAY,UAAU,EAE7DU,EAAcC,EAAS,IAAIC,EAAK,CAClC,KAAOV,EAAK,KACZ,MAAQA,EAAK,MACb,SAAW,EACnB,CAAK,CAAC,EACIW,EAAeF,EAAS,IAAIC,EAAK,CACnC,gBAAkB,GAClB,SAAW,GACX,sBAAwB,EAChC,CAAK,CAAC,EACIE,EAAaH,EAAS,IAAIC,EAAK,CACjC,SAAW,EACnB,CAAK,CAAC,EAKF,SAASG,EAAcC,EAAG,CAEtBN,EAAY,IAAI,QAAS,CAAC,YAAa,EAAI,CAAC,EAC3C,KAAKO,GAAY,CACdf,EAAK,OAAO,CACR,KAAMe,EAAS,KAAK,KACpB,MAAOA,EAAS,KAAK,MACrB,QAASA,EAAS,KAAK,QAC1B,CAAA,EACDb,EAAO,QAAQ,CAAE,KAAMc,EAAM,0BAA0B,CAAG,CAAA,CAC7D,CAAA,EACA,MAAMC,GAAS,CACRA,EAAM,SAAS,SAAW,IAC1Bf,EAAO,MAAM,CAAE,KAAMe,EAAM,SAAS,KAAK,OAAS,CAAA,EAE7CA,EAAM,SAAS,SAAW,KAC/Bf,EAAO,MAAMe,EAAM,QAAQ,CAElC,CAAA,CACT,CAKK,SAASC,EAAeJ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