From 8273cdba66e62af572b67aebb58e65a4b8814d82 Mon Sep 17 00:00:00 2001
From: Christoph Wurst
Date: Mon, 14 May 2018 09:29:21 +0200
Subject: Make it possible to revoke the registration
Signed-off-by: Christoph Wurst
---
js/service/registration.js | 13 +++++++++++++
js/view/settings.vue | 16 +++++++++++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
(limited to 'js')
diff --git a/js/service/registration.js b/js/service/registration.js
index a6aa230..dddfc26 100644
--- a/js/service/registration.js
+++ b/js/service/registration.js
@@ -40,3 +40,16 @@ export function tryVerification(code) {
throw resp;
})
}
+
+export function disable() {
+ let url = OC.generateUrl('/apps/twofactor_sms/settings/verification')
+
+ return nc_fetch_json(url, {
+ method: 'DELETE'
+ }).then(function (resp) {
+ if (resp.ok) {
+ return resp.json();
+ }
+ throw resp;
+ })
+}
diff --git a/js/view/settings.vue b/js/view/settings.vue
index b58f7ee..bdf6973 100644
--- a/js/view/settings.vue
+++ b/js/view/settings.vue
@@ -17,6 +17,7 @@
+
@@ -27,7 +28,8 @@ import l10n from "view/l10n.vue";
import {
getState,
startVerification,
- tryVerification
+ tryVerification,
+ disable
} from "service/registration";
export default {
@@ -68,6 +70,18 @@ export default {
this.loading = false;
})
.catch(console.error.bind(this));
+ },
+
+ disable: function() {
+ this.loading = true;
+
+ disable()
+ .then(res => {
+ this.state = res.state;
+ this.phoneNumber = res.phoneNumber;
+ this.loading = false;
+ })
+ .catch(console.error.bind(this));
}
},
components: {
--
cgit v1.2.3