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-08-24 14:29:39 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2018-08-24 14:29:39 +0300
commit0e69869d9e18b21a3931f3ccbc7d927bb42a349d (patch)
tree9036474bb78233144933ca6bf79727291cff7722 /js
parent6dc686b552d0535f92f45b922a53cd6a435ada2a (diff)
Show gateway not configured info in user settings
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'js')
-rw-r--r--js/components/GatewaySettings.vue9
-rw-r--r--js/service/registration.js11
2 files changed, 18 insertions, 2 deletions
diff --git a/js/components/GatewaySettings.vue b/js/components/GatewaySettings.vue
index dbbe4d9..119ec0b 100644
--- a/js/components/GatewaySettings.vue
+++ b/js/components/GatewaySettings.vue
@@ -1,5 +1,9 @@
<template>
- <div v-if="loading">
+ <div v-if="!isAvailable">
+ <L10n text="The {displayName} gateway is not configured."
+ :options="{displayName: displayName}" />
+ </div>
+ <div v-else-if="loading">
<span class="icon-loading-small"></span>
</div>
<div v-else>
@@ -57,6 +61,7 @@
return {
loading: true,
state: 0,
+ isAvailable: true,
phoneNumber: '',
confirmationCode: '',
identifier: '',
@@ -66,6 +71,8 @@
mounted: function () {
getState(this.gatewayName)
.then(res => {
+ console.debug('loaded state for gateway ' + this.gatewayName, res);
+ this.isAvailable = res.isAvailable;
this.state = res.state;
this.phoneNumber = res.phoneNumber;
this.loading = false;
diff --git a/js/service/registration.js b/js/service/registration.js
index 16a686c..d65c6a7 100644
--- a/js/service/registration.js
+++ b/js/service/registration.js
@@ -7,7 +7,16 @@ export function getState (gateway) {
return nc_fetch_json(url).then(function (resp) {
if (resp.ok) {
- return resp.json()
+ return resp.json().then(json => {
+ json.isAvailable = true
+ return json
+ })
+ }
+ if (resp.status === 503) {
+ console.info(gateway + ' gateway is not available')
+ return {
+ isAvailable: false
+ }
}
throw resp
})