enter to login, google auth only show if configured

This commit is contained in:
Martin McKeaveney 2021-05-21 14:45:56 +01:00
parent bd61619d13
commit 6a293df4be
2 changed files with 27 additions and 14 deletions

View File

@ -1,8 +1,21 @@
<script> <script>
import { onMount } from "svelte"
import { ActionButton } from "@budibase/bbui" import { ActionButton } from "@budibase/bbui"
import GoogleLogo from "/assets/google-logo.png" import GoogleLogo from "/assets/google-logo.png"
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
}
</script> </script>
{#if show}
<ActionButton> <ActionButton>
<a target="_blank" href="/api/admin/auth/google"> <a target="_blank" href="/api/admin/auth/google">
<div class="inner"> <div class="inner">
@ -11,14 +24,9 @@
</div> </div>
</a> </a>
</ActionButton> </ActionButton>
{/if}
<style> <style>
.outer {
border: 1px solid #494949;
border-radius: 4px;
width: 100%;
background-color: var(--background-alt);
}
.inner { .inner {
display: flex; display: flex;
flex-direction: row; flex-direction: row;

View File

@ -38,8 +38,13 @@
notifications.error("Invalid credentials") notifications.error("Invalid credentials")
} }
} }
function handleKeydown(evt) {
if (evt.key === "Enter") login()
}
</script> </script>
<svelte:window on:keydown={handleKeydown} />
<div class="login"> <div class="login">
<div class="main"> <div class="main">
<Layout> <Layout>