From 6eba09aa5aeaf7923518af609c334d0b461a4790 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Fri, 14 Feb 2020 11:19:17 +0100 Subject: [PATCH] register/login: display if there are no remote sources Show if no remote sources are defined or if no remote sources are register/login enabled. --- src/views/Login.vue | 66 +++++++++++++++++++++++++++++++----------- src/views/Register.vue | 58 ++++++++++++++++++++++++++++++------- 2 files changed, 97 insertions(+), 27 deletions(-) diff --git a/src/views/Login.vue b/src/views/Login.vue index ae0f78d..bb4c90a 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -9,24 +9,40 @@
-
- -
-
-
- + No remote sources defined +
+
+ No remote sources enabled for login +
+
+
+
+ +
+
+
+ +
@@ -58,6 +74,22 @@ export default { remotesources: null }; }, + computed: { + hasRemoteSources() { + if (this.remotesources) { + return this.remotesources.length > 0; + } + return false; + }, + hasLoginRemoteSources() { + for (let rs of this.remotesources) { + if (rs.login_enabled) { + return true; + } + } + return false; + } + }, methods: { async fetchRemoteSources() { let { data, error } = await fetchRemoteSources(); diff --git a/src/views/Register.vue b/src/views/Register.vue index a51e859..8f15a95 100644 --- a/src/views/Register.vue +++ b/src/views/Register.vue @@ -12,10 +12,29 @@
+
+ No remote sources defined +
+
+ No remote sources enabled for registration +
Register with {{rs.name}} + > + Register with {{ rs.name }} +
@@ -68,7 +89,22 @@ export default { }; }, computed: { - ...mapGetters(["registeruser"]) + ...mapGetters(["registeruser"]), + + hasRemoteSources() { + if (this.remotesources) { + return this.remotesources.length > 0; + } + return false; + }, + hasRegisterRemoteSources() { + for (let rs of this.remotesources) { + if (rs.registration_enabled) { + return true; + } + } + return false; + } }, methods: { async fetchRemoteSources() { @@ -81,14 +117,16 @@ export default { }, async doAuthorize(remotesourcename, username, password) { let u = authorizeurl(); - let res = await (await fetch(u, { - method: "POST", - body: JSON.stringify({ - remote_source_name: remotesourcename, - login_name: username, - password: password + let res = await ( + await fetch(u, { + method: "POST", + body: JSON.stringify({ + remote_source_name: remotesourcename, + login_name: username, + password: password + }) }) - })).json(); + ).json(); if (res.oauth2_redirect) { window.location = res.oauth2_redirect;