diff options
| author | Henry Jameson <me@hjkos.com> | 2019-06-13 00:51:14 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2019-06-13 00:51:14 +0300 |
| commit | c8a57ad32e6d47a114e3d744b4b6a0666e9e01f7 (patch) | |
| tree | de02290d6d97733c0ff7a041731b8c95e98b6c95 /src/components/user_settings/mfa_totp.js | |
| parent | 1e94aecbc951c7508a0063de0c6cd90b40a040d8 (diff) | |
| parent | e53f11c30fb2eedd0a437d3cfe9592c555de6a95 (diff) | |
Merge remote-tracking branch 'upstream/develop' into masto-register-app-secret
* upstream/develop:
Revert "add TOTP/Recovery Form for mobile version"
Diffstat (limited to 'src/components/user_settings/mfa_totp.js')
| -rw-r--r-- | src/components/user_settings/mfa_totp.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/components/user_settings/mfa_totp.js b/src/components/user_settings/mfa_totp.js new file mode 100644 index 00000000..8408d8e9 --- /dev/null +++ b/src/components/user_settings/mfa_totp.js @@ -0,0 +1,49 @@ +import Confirm from './confirm.vue' +import { mapState } from 'vuex' + +export default { + props: ['settings'], + data: () => ({ + error: false, + currentPassword: '', + deactivate: false, + inProgress: false // progress peform request to disable otp method + }), + components: { + 'confirm': Confirm + }, + computed: { + isActivated () { + return this.settings.totp + }, + ...mapState({ + backendInteractor: (state) => state.api.backendInteractor + }) + }, + methods: { + doActivate () { + this.$emit('activate') + }, + cancelDeactivate () { this.deactivate = false }, + doDeactivate () { + this.error = null + this.deactivate = true + }, + confirmDeactivate () { // confirm deactivate TOTP method + this.error = null + this.inProgress = true + this.backendInteractor.mfaDisableOTP({ + password: this.currentPassword + }) + .then((res) => { + this.inProgress = false + if (res.error) { + this.error = res.error + return + } + this.deactivate = false + this.$emit('deactivate') + }) + } + } +} |
