logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

mfa_totp.js (1134B)


  1. import Confirm from './confirm.vue'
  2. import { mapState } from 'vuex'
  3. export default {
  4. props: ['settings'],
  5. data: () => ({
  6. error: false,
  7. currentPassword: '',
  8. deactivate: false,
  9. inProgress: false // progress peform request to disable otp method
  10. }),
  11. components: {
  12. confirm: Confirm
  13. },
  14. computed: {
  15. isActivated () {
  16. return this.settings.totp
  17. },
  18. ...mapState({
  19. backendInteractor: (state) => state.api.backendInteractor
  20. })
  21. },
  22. methods: {
  23. doActivate () {
  24. this.$emit('activate')
  25. },
  26. cancelDeactivate () { this.deactivate = false },
  27. doDeactivate () {
  28. this.error = null
  29. this.deactivate = true
  30. },
  31. confirmDeactivate () { // confirm deactivate TOTP method
  32. this.error = null
  33. this.inProgress = true
  34. this.backendInteractor.mfaDisableOTP({
  35. password: this.currentPassword
  36. })
  37. .then((res) => {
  38. this.inProgress = false
  39. if (res.error) {
  40. this.error = res.error
  41. return
  42. }
  43. this.deactivate = false
  44. this.$emit('deactivate')
  45. })
  46. }
  47. }
  48. }