From 0e75c8062725eab5d0445eec4d0a3c22bfa46bc5 Mon Sep 17 00:00:00 2001
From: lukeIam <2lukeiam@gmail.com>
Date: Wed, 20 Sep 2023 19:45:32 +0100
Subject: [PATCH] prepare show/hide of login buttons
---
client/pages/login.vue | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/client/pages/login.vue b/client/pages/login.vue
index beac44ff..29341ed3 100644
--- a/client/pages/login.vue
+++ b/client/pages/login.vue
@@ -27,7 +27,7 @@
{{ $strings.HeaderLogin }}
{{ error }}
-
@@ -222,9 +222,28 @@ export default {
this.processing = false
this.criticalError = 'Status check failed'
})
+ },
+ async updateLoginVisibility() {
+ await this.$axios
+ .$get('/auth_methods')
+ .then((response) => {
+ ;['local', 'google-oauth20', 'openid'].forEach((auth_method) => {
+ debugger
+ if (response.includes(auth_method)) {
+ // TODO: show `#login-${auth_method}`
+ } else {
+ // TODO: hide `#login-${auth_method}`
+ }
+ })
+ })
+ .catch((error) => {
+ console.error('Failed', error.response)
+ return false
+ })
}
},
async mounted() {
+ this.updateLoginVisibility()
if (new URLSearchParams(window.location.search).get('setToken')) {
localStorage.setItem('token', new URLSearchParams(window.location.search).get('setToken'))
}