From bef216527d48867080395df4d2f24b5352c9305b Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Fri, 21 May 2021 14:55:11 +0100 Subject: [PATCH] simpler check using checklist --- .../pages/builder/auth/_components/GoogleButton.svelte | 10 ++-------- packages/worker/src/api/controllers/admin/configs.js | 6 ++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/builder/src/pages/builder/auth/_components/GoogleButton.svelte b/packages/builder/src/pages/builder/auth/_components/GoogleButton.svelte index 0b4ab35e45..3eaf048872 100644 --- a/packages/builder/src/pages/builder/auth/_components/GoogleButton.svelte +++ b/packages/builder/src/pages/builder/auth/_components/GoogleButton.svelte @@ -2,17 +2,11 @@ import { onMount } from "svelte" import { ActionButton } from "@budibase/bbui" import GoogleLogo from "/assets/google-logo.png" + import { admin } from "stores/portal" let show = false - async function fetchConfig() { - const googleResponse = await api.get( - `/api/admin/configs/${ConfigTypes.Google}` - ) - const googleDoc = await googleResponse.json() - - if (googleDoc._id) show = true - } + $: show = $admin.checklist?.oauth {#if show} diff --git a/packages/worker/src/api/controllers/admin/configs.js b/packages/worker/src/api/controllers/admin/configs.js index 7845eee0d6..8a6788cdfd 100644 --- a/packages/worker/src/api/controllers/admin/configs.js +++ b/packages/worker/src/api/controllers/admin/configs.js @@ -168,6 +168,11 @@ exports.configChecklist = async function (ctx) { type: Configs.SMTP, }) + // They have set up Google Auth + const oauthConfig = await getScopedFullConfig(db, { + type: Configs.GOOGLE, + }) + // They have set up an admin user const users = await db.allDocs( getGlobalUserParams(null, { @@ -180,6 +185,7 @@ exports.configChecklist = async function (ctx) { apps: appDbNames.length, smtp: !!smtpConfig, adminUser, + oauth: !!oauthConfig, } } catch (err) { ctx.throw(err.status, err)