admin-profile.component.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. export default {
  2. name: 'admin-profile',
  3. props: ['email', 'name', 'provider', 'tfaIsActive'],
  4. data() {
  5. return {
  6. password: '********',
  7. passwordVerify: '********'
  8. }
  9. },
  10. computed: {
  11. tfaStatus() {
  12. return this.tfaIsActive ? this.$t('profile.tfaenabled') : this.$t('profile.tfadisabled')
  13. }
  14. },
  15. methods: {
  16. saveUser() {
  17. let self = this
  18. if (this.password !== this.passwordVerify) {
  19. return self.$store.dispatch('alert', {
  20. style: 'red',
  21. icon: 'square-cross',
  22. msg: 'The passwords don\'t match. Try again.'
  23. })
  24. }
  25. this.$http.post(window.location.href, {
  26. password: this.password,
  27. name: this.name
  28. }).then(resp => {
  29. self.$store.dispatch('alert', {
  30. style: 'green',
  31. icon: 'check',
  32. msg: 'Changes have been applied successfully.'
  33. })
  34. }).catch(err => {
  35. self.$store.dispatch('alert', {
  36. style: 'red',
  37. icon: 'square-cross',
  38. msg: 'Error: ' + err.body.msg
  39. })
  40. })
  41. }
  42. }
  43. }