Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/twofactor_gateway.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2018-05-14 10:29:21 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2018-05-14 10:29:21 +0300
commit8273cdba66e62af572b67aebb58e65a4b8814d82 (patch)
treeb6e7b1b97fd842554aa6777d535a1b9f58a0117c /js
parent5ca03f2ab7d4747560f82102f27b1cf1fb9010a0 (diff)
Make it possible to revoke the registration
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'js')
-rw-r--r--js/service/registration.js13
-rw-r--r--js/view/settings.vue16
2 files changed, 28 insertions, 1 deletions
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 @@
</p>
<p v-if="state === 2">
<l10n text="SMS-based two-factor authentication is enabled for your account."></l10n>
+ <button @click="disable"><l10n text="Disable"></l10n></button>
</p>
</div>
</div>
@@ -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: {