2017-05-21 03:21:16 +00:00
|
|
|
export default {
|
|
|
|
name: 'admin-profile',
|
2017-06-12 01:11:01 +00:00
|
|
|
props: ['email', 'name', 'provider', 'tfaIsActive'],
|
2017-05-21 03:21:16 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
password: '********',
|
|
|
|
passwordVerify: '********'
|
|
|
|
}
|
|
|
|
},
|
2017-06-12 01:11:01 +00:00
|
|
|
computed: {
|
|
|
|
tfaStatus() {
|
|
|
|
return this.tfaIsActive ? this.$t('profile.tfaenabled') : this.$t('profile.tfadisabled')
|
|
|
|
}
|
|
|
|
},
|
2017-05-21 03:21:16 +00:00
|
|
|
methods: {
|
|
|
|
saveUser() {
|
2017-05-21 20:43:58 +00:00
|
|
|
let self = this
|
2017-05-21 03:21:16 +00:00
|
|
|
if (this.password !== this.passwordVerify) {
|
2017-05-21 20:43:58 +00:00
|
|
|
return self.$store.dispatch('alert', {
|
|
|
|
style: 'red',
|
|
|
|
icon: 'square-cross',
|
|
|
|
msg: 'The passwords don\'t match. Try again.'
|
|
|
|
})
|
2017-05-21 03:21:16 +00:00
|
|
|
}
|
2017-05-21 20:43:58 +00:00
|
|
|
this.$http.post(window.location.href, {
|
2017-05-21 03:21:16 +00:00
|
|
|
password: this.password,
|
|
|
|
name: this.name
|
2017-05-21 20:43:58 +00:00
|
|
|
}).then(resp => {
|
|
|
|
self.$store.dispatch('alert', {
|
|
|
|
style: 'green',
|
|
|
|
icon: 'check',
|
|
|
|
msg: 'Changes have been applied successfully.'
|
|
|
|
})
|
|
|
|
}).catch(err => {
|
|
|
|
self.$store.dispatch('alert', {
|
|
|
|
style: 'red',
|
|
|
|
icon: 'square-cross',
|
|
|
|
msg: 'Error: ' + err.body.msg
|
|
|
|
})
|
2017-05-21 03:21:16 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|