mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-05-25 11:33:00 +00:00

Former-commit-id: 987a3c3c697fb3d529634c1a8f66dde0f450f5a1 [formerly ee09941b44acdf0700d756d72e225a161471dcd2] [formerly e0243da57fccd6a4765a2c16e4ee45356d76062f [formerly f2b880dccfd3304ad91d2ff2b89ccf7f4f7e9d7b]] Former-commit-id: 4a1e27fbe8a524a0eb90f7ae157253ba2d6d29a4 [formerly 66a205c72125cf1666468a21097926196214bb0b] Former-commit-id: 3b974ca50af3176bcc6497bbda18deef5347cbe5
83 lines
2.0 KiB
Vue
83 lines
2.0 KiB
Vue
<template>
|
|
<div class="dashboard">
|
|
<h1>Profile Settings</h1>
|
|
|
|
<ul v-if="user.admin">
|
|
<li><router-link to="/settings/global">Go to Global Settings</router-link></li>
|
|
</ul>
|
|
|
|
<form @submit="changePassword">
|
|
<h2>Change Password</h2>
|
|
<p><input :class="passwordClass" type="password" placeholder="Your new password" v-model="password" name="password"></p>
|
|
<p><input :class="passwordClass" type="password" placeholder="Confirm your new password" v-model="passwordConf" name="password"></p>
|
|
<p><input type="submit" value="Change Password"></p>
|
|
</form>
|
|
|
|
<form @submit="updateCSS">
|
|
<h2>Costum Stylesheet</h2>
|
|
<textarea v-model="css" name="css"></textarea>
|
|
<p><input type="submit" value="Update"></p>
|
|
</form>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapState, mapMutations } from 'vuex'
|
|
import api from '@/utils/api'
|
|
|
|
export default {
|
|
name: 'settings',
|
|
data: function () {
|
|
return {
|
|
password: '',
|
|
passwordConf: '',
|
|
css: ''
|
|
}
|
|
},
|
|
computed: {
|
|
...mapState([ 'user' ]),
|
|
passwordClass () {
|
|
if (this.password === '' && this.passwordConf === '') {
|
|
return ''
|
|
}
|
|
|
|
if (this.password === this.passwordConf) {
|
|
return 'green'
|
|
}
|
|
|
|
return 'red'
|
|
}
|
|
},
|
|
created () {
|
|
this.css = this.user.css
|
|
},
|
|
methods: {
|
|
...mapMutations([ 'showSuccess' ]),
|
|
changePassword (event) {
|
|
event.preventDefault()
|
|
|
|
if (this.password !== this.passwordConf) {
|
|
return
|
|
}
|
|
|
|
api.updatePassword(this.password).then(() => {
|
|
this.showSuccess('Password updated!')
|
|
}).catch(e => {
|
|
this.$store.commit('showError', e)
|
|
})
|
|
},
|
|
updateCSS (event) {
|
|
event.preventDefault()
|
|
|
|
api.updateCSS(this.css).then(() => {
|
|
this.$store.commit('setUserCSS', this.css)
|
|
this.$emit('css-updated')
|
|
this.showSuccess('Styles updated!')
|
|
}).catch(e => {
|
|
this.$store.commit('showError', e)
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|