You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.1 KiB

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