fix editable fedi username in settings
This commit is contained in:
@@ -160,6 +160,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
settings: {
|
settings: {
|
||||||
|
update_confirm: 'Sicura di voler salvare le modifiche?',
|
||||||
change_password: 'Cambia password',
|
change_password: 'Cambia password',
|
||||||
password_updated: 'Password modificata',
|
password_updated: 'Password modificata',
|
||||||
danger_section: 'Sezione pericolosa',
|
danger_section: 'Sezione pericolosa',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
nuxt-link.float-right(to='/')
|
nuxt-link.float-right(to='/')
|
||||||
el-button(circle icon='el-icon-close' type='danger' size='small' plain)
|
el-button(circle icon='el-icon-close' type='danger' size='small' plain)
|
||||||
h5 {{$t('common.settings')}}
|
h5 {{$t('common.settings')}}
|
||||||
hr
|
el-divider {{$auth.user.email}}
|
||||||
|
|
||||||
el-form(action='/api/user' method='PUT' @submit.native.prevent='update_settings' inline label-width='200px')
|
el-form(action='/api/user' method='PUT' @submit.native.prevent='update_settings' inline label-width='200px')
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
div(v-if='user.settings.enable_federation')
|
div(v-if='user.settings.enable_federation')
|
||||||
el-form-item(:label="$t('common.username')")
|
el-form-item(:label="$t('common.username')")
|
||||||
el-input(v-if='user.username.length==0' type='text' name='username' v-model='user.username')
|
el-input(v-if='username_editable' type='text' name='username' v-model='user.username')
|
||||||
template(slot='suffix') @{{baseurl}}
|
template(slot='suffix') @{{baseurl}}
|
||||||
span(v-else) {{user.username}}@{{baseurl}}
|
span(v-else) {{user.username}}@{{baseurl}}
|
||||||
//- el-button(slot='append') {{$t('common.save')}}
|
//- el-button(slot='append') {{$t('common.save')}}
|
||||||
@@ -40,6 +40,7 @@ export default {
|
|||||||
name: 'Settings',
|
name: 'Settings',
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
username_editable: false,
|
||||||
password: '',
|
password: '',
|
||||||
user: { }
|
user: { }
|
||||||
}
|
}
|
||||||
@@ -51,7 +52,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async asyncData ({ $axios, params }) {
|
async asyncData ({ $axios, params }) {
|
||||||
const user = await $axios.$get('/auth/user')
|
const user = await $axios.$get('/auth/user')
|
||||||
return { user }
|
return { user, username_editable: user.username.length===0 }
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['settings']),
|
...mapState(['settings']),
|
||||||
@@ -72,12 +73,16 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async update_settings () {
|
async update_settings () {
|
||||||
try {
|
MessageBox.confirm(this.$t('settings.update_confirm'),
|
||||||
const user = await this.$axios.$put('/user', { ...this.user, password: this.password })
|
this.$t('common.confirm'), {
|
||||||
this.user = user
|
confirmButtonText: this.$t('common.ok'),
|
||||||
} catch (e) {
|
cancelButtonText: this.$t('common.cancel'),
|
||||||
|
type: 'error'
|
||||||
|
}).then(async () => {
|
||||||
|
this.user = await this.$axios.$put('/user', { ...this.user, password: this.password })
|
||||||
|
}).catch( e => {
|
||||||
Message({ message: e, showClose: true, type: 'warning' })
|
Message({ message: e, showClose: true, type: 'warning' })
|
||||||
}
|
})
|
||||||
},
|
},
|
||||||
async remove_account () {
|
async remove_account () {
|
||||||
MessageBox.confirm(this.$t('settings.remove_account_confirm'), this.$t('common.confirm'), {
|
MessageBox.confirm(this.$t('settings.remove_account_confirm'), this.$t('common.confirm'), {
|
||||||
|
|||||||
Reference in New Issue
Block a user