mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-12 02:00:47 +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_
|