better config / install from cli / allow_registration

This commit is contained in:
lesion
2019-06-21 23:52:18 +02:00
parent 4c3c7ee324
commit cf81a73f2f
38 changed files with 530 additions and 272 deletions

View File

@@ -5,14 +5,18 @@
v-icon(name='times' color='red')
h5 {{$t('common.settings')}}
el-form(action='/api/user' method='PUT' @submit.native.prevent='change')
el-form(action='/api/user' method='PUT' @submit.native.prevent='change_password')
el-form-item {{$t('settings.change_password')}}
el-input(v-model='password' type='password')
el-button(type='success' native-type='submit') {{$t('common.send')}}
el-divider {{$t('settings.danger_section')}}
p {{$t('settings.remove_account')}}
el-button(type='danger' @click='remove_account') {{$t('common.remove')}}
</template>
<script>
import { mapState, mapActions } from 'vuex'
import { Message } from 'element-ui'
import { Message, MessageBox } from 'element-ui'
export default {
data () {
@@ -20,13 +24,13 @@ export default {
password: '',
}
},
// async asyncData ({ $axios, params }) {
// const user = await $axios.$get('/auth/user')
// user.mastodon_auth = ''
// return { user }
// },
async asyncData ({ $axios, params }) {
const user = await $axios.$get('/auth/user')
user.mastodon_auth = ''
return { user }
},
methods: {
async change () {
async change_password () {
if (!this.password) return
const user_data = { id : this.$auth.user.id, password: this.password }
try {
@@ -37,6 +41,15 @@ export default {
console.log(e)
}
},
async remove_account () {
MessageBox.confirm(this.$t('settings.remove_account_confirm'), this.$t('common.confirm'), {
confirmButtonText: this.$t('common.ok'),
cancelButtonText: this.$t('common.cancel'),
type: 'error'
}).then( () => {
this.$axios.$delete('/user')
})
}
}
}
</script>