Martin McKeaveney
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
27 additions and
14 deletions
-
packages/builder/src/pages/builder/auth/_components/GoogleButton.svelte
-
packages/builder/src/pages/builder/auth/login.svelte
-
packages/worker/src/api/controllers/admin/configs.js
|
|
|
@ -1,24 +1,26 @@ |
|
|
|
<script> |
|
|
|
import { onMount } from "svelte" |
|
|
|
import { ActionButton } from "@budibase/bbui" |
|
|
|
import GoogleLogo from "/assets/google-logo.png" |
|
|
|
import { admin } from "stores/portal" |
|
|
|
|
|
|
|
let show = false |
|
|
|
|
|
|
|
$: show = $admin.checklist?.oauth |
|
|
|
</script> |
|
|
|
|
|
|
|
<ActionButton> |
|
|
|
<a target="_blank" href="/api/admin/auth/google"> |
|
|
|
<div class="inner"> |
|
|
|
<img src={GoogleLogo} alt="google icon" /> |
|
|
|
<p>Sign in with Google</p> |
|
|
|
</div> |
|
|
|
</a> |
|
|
|
</ActionButton> |
|
|
|
{#if show} |
|
|
|
<ActionButton> |
|
|
|
<a target="_blank" href="/api/admin/auth/google"> |
|
|
|
<div class="inner"> |
|
|
|
<img src={GoogleLogo} alt="google icon" /> |
|
|
|
<p>Sign in with Google</p> |
|
|
|
</div> |
|
|
|
</a> |
|
|
|
</ActionButton> |
|
|
|
{/if} |
|
|
|
|
|
|
|
<style> |
|
|
|
.outer { |
|
|
|
border: 1px solid #494949; |
|
|
|
border-radius: 4px; |
|
|
|
width: 100%; |
|
|
|
background-color: var(--background-alt); |
|
|
|
} |
|
|
|
.inner { |
|
|
|
display: flex; |
|
|
|
flex-direction: row; |
|
|
|
|
|
|
|
@ -38,8 +38,13 @@ |
|
|
|
notifications.error("Invalid credentials") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function handleKeydown(evt) { |
|
|
|
if (evt.key === "Enter") login() |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<svelte:window on:keydown={handleKeydown} /> |
|
|
|
<div class="login"> |
|
|
|
<div class="main"> |
|
|
|
<Layout> |
|
|
|
|
|
|
|
@ -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) |
|
|
|
|