Add auth
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<script>
|
||||
if (navigator.platform === 'iPhone') document.documentElement.classList.add('ios');
|
||||
const pageData = {
|
||||
slug: "{{ .Page.Slug }}",
|
||||
/*{{ if .Page }}*/slug: "{{ .Page.Slug }}",/*{{ end }}*/
|
||||
baseURL: "{{ .App.Config.Server.BaseURL }}",
|
||||
theme: "{{ .Request.Theme.Key }}",
|
||||
};
|
||||
@@ -24,11 +24,10 @@
|
||||
<link rel="icon" type="image/png" href='{{ .App.StaticAssetPath "favicon.png" }}' />
|
||||
<link rel="icon" type="{{ .App.Config.Branding.FaviconType }}" href="{{ .App.Config.Branding.FaviconURL }}" />
|
||||
<link rel="stylesheet" href='{{ .App.StaticAssetPath "css/bundle.css" }}'>
|
||||
<script type="module" src='{{ .App.StaticAssetPath "js/main.js" }}'></script>
|
||||
<style id="theme-style">
|
||||
{{ .Request.Theme.CSS }}
|
||||
</style>
|
||||
<style id="theme-style">{{ .Request.Theme.CSS }}</style>
|
||||
{{ if .App.Config.Theme.CustomCSSFile }}<link rel="stylesheet" href="{{ .App.Config.Theme.CustomCSSFile }}?v={{ .App.CreatedAt.Unix }}">{{ end }}
|
||||
{{ block "document-head-after" . }}{{ end }}
|
||||
{{ if .App.Config.Document.Head }}{{ .App.Config.Document.Head }}{{ end }}
|
||||
</head>
|
||||
<body>
|
||||
{{ template "document-body" . }}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{{ if not .App.Config.Branding.HideFooter }}
|
||||
<footer class="footer flex items-center flex-column">
|
||||
{{ if eq "" .App.Config.Branding.CustomFooter }}
|
||||
<div>
|
||||
<a class="size-h3" href="https://github.com/glanceapp/glance" target="_blank" rel="noreferrer">Glance</a> {{ if ne "dev" .App.Version }}<a class="visited-indicator" title="Release notes" href="https://github.com/glanceapp/glance/releases/tag/{{ .App.Version }}" target="_blank" rel="noreferrer">{{ .App.Version }}</a>{{ else }}({{ .App.Version }}){{ end }}
|
||||
</div>
|
||||
{{ else }}
|
||||
{{ .App.Config.Branding.CustomFooter }}
|
||||
{{ end }}
|
||||
</footer>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,53 @@
|
||||
{{- template "document.html" . }}
|
||||
|
||||
{{- define "document-title" }}Login{{ end }}
|
||||
|
||||
{{- define "document-head-before" }}
|
||||
<link rel="preload" href='{{ .App.StaticAssetPath "js/templating.js" }}' as="script"/>
|
||||
<link rel="prefetch" href='{{ .App.StaticAssetPath "js/page.js" }}'/>
|
||||
{{- end }}
|
||||
|
||||
{{- define "document-head-after" }}
|
||||
<link rel="stylesheet" href='{{ .App.StaticAssetPath "css/login.css" }}'>
|
||||
<script type="module" src='{{ .App.StaticAssetPath "js/login.js" }}'></script>
|
||||
{{- end }}
|
||||
|
||||
{{- define "document-body" }}
|
||||
<div class="flex flex-column body-content">
|
||||
<div class="flex grow items-center justify-center" style="padding-bottom: 5rem">
|
||||
<h1 class="visually-hidden">Login</h1>
|
||||
<main id="login-container" class="grow login-bounds" style="display: none;">
|
||||
<div class="animate-entrance">
|
||||
<label class="form-label widget-header" for="username">Username</label>
|
||||
<div class="form-input widget-content-frame padding-inline-widget flex gap-10 items-center">
|
||||
<svg class="form-input-icon" fill="var(--color-text-subdue)" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" aria-hidden="true">
|
||||
<path d="M10 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM3.465 14.493a1.23 1.23 0 0 0 .41 1.412A9.957 9.957 0 0 0 10 18c2.31 0 4.438-.784 6.131-2.1.43-.333.604-.903.408-1.41a7.002 7.002 0 0 0-13.074.003Z" />
|
||||
</svg>
|
||||
<input type="text" id="username" class="input" placeholder="Enter your username" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="animate-entrance">
|
||||
<label class="form-label widget-header margin-top-20" for="password">Password</label>
|
||||
<div class="form-input widget-content-frame padding-inline-widget flex gap-10 items-center">
|
||||
<svg class="form-input-icon" fill="var(--color-text-subdue)" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" aria-hidden="true">
|
||||
<path fill-rule="evenodd" d="M8 7a5 5 0 1 1 3.61 4.804l-1.903 1.903A1 1 0 0 1 9 14H8v1a1 1 0 0 1-1 1H6v1a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-2a1 1 0 0 1 .293-.707L8.196 8.39A5.002 5.002 0 0 1 8 7Zm5-3a.75.75 0 0 0 0 1.5A1.5 1.5 0 0 1 14.5 7 .75.75 0 0 0 16 7a3 3 0 0 0-3-3Z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
<input type="password" id="password" class="input" placeholder="********" autocomplete="off">
|
||||
<button class="toggle-password-visibility" id="toggle-password-visibility" tabindex="-1"></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="login-error-message" id="error-message"></div>
|
||||
|
||||
<button class="login-button animate-entrance" id="login-button">
|
||||
<div>LOGIN</div>
|
||||
<svg stroke="currentColor" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" aria-hidden="true">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3" />
|
||||
</svg>
|
||||
</button>
|
||||
</main>
|
||||
</div>
|
||||
{{ template "footer.html" . }}
|
||||
</div>
|
||||
{{- end }}
|
||||
@@ -3,11 +3,7 @@
|
||||
{{ define "document-title" }}{{ .Page.Title }}{{ end }}
|
||||
|
||||
{{ define "document-head-after" }}
|
||||
{{ if ne "" .App.Config.Theme.CustomCSSFile }}
|
||||
<link rel="stylesheet" href="{{ .App.Config.Theme.CustomCSSFile }}?v={{ .App.CreatedAt.Unix }}">
|
||||
{{ end }}
|
||||
|
||||
{{ if ne "" .App.Config.Document.Head }}{{ .App.Config.Document.Head }}{{ end }}
|
||||
<script type="module" src='{{ .App.StaticAssetPath "js/page.js" }}'></script>
|
||||
{{ end }}
|
||||
|
||||
{{ define "navigation-links" }}
|
||||
@@ -19,12 +15,12 @@
|
||||
{{ define "document-body" }}
|
||||
<div class="flex flex-column body-content">
|
||||
{{ if not .Page.HideDesktopNavigation }}
|
||||
<div class="header-container content-bounds{{ if ne "" .Page.DesktopNavigationWidth }} content-bounds-{{ .Page.DesktopNavigationWidth }} {{ end }}">
|
||||
<div class="header-container content-bounds{{ if .Page.DesktopNavigationWidth }} content-bounds-{{ .Page.DesktopNavigationWidth }} {{ end }}">
|
||||
<div class="header flex padding-inline-widget widget-content-frame">
|
||||
<div class="logo" aria-hidden="true">
|
||||
{{- if .App.Config.Branding.LogoURL }}
|
||||
<img src="{{ .App.Config.Branding.LogoURL }}" alt="">
|
||||
{{- else if ne "" .App.Config.Branding.LogoText }}
|
||||
{{- else if .App.Config.Branding.LogoText }}
|
||||
{{- .App.Config.Branding.LogoText }}
|
||||
{{- else }}
|
||||
<svg style="max-height: 2rem;" width="100%" viewBox="0 0 108 108" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
@@ -37,7 +33,7 @@
|
||||
<nav class="nav flex grow hide-scrollbars">
|
||||
{{ template "navigation-links" . }}
|
||||
</nav>
|
||||
<div class="theme-picker self-center" data-popover-type="html" data-popover-position="below" data-popover-show-delay="0" data-popover-offset="0.7">
|
||||
<div class="theme-picker self-center" data-popover-type="html" data-popover-position="below" data-popover-show-delay="0">
|
||||
<div class="current-theme-preview">
|
||||
{{ .Request.Theme.PreviewHTML }}
|
||||
</div>
|
||||
@@ -50,6 +46,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{- if .App.RequiresAuth }}
|
||||
<a class="block self-center" href="{{ .App.Config.Server.BaseURL }}/logout" title="Logout">
|
||||
<svg class="logout-button" stroke="var(--color-text-subdue)" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0 0 13.5 3h-6a2.25 2.25 0 0 0-2.25 2.25v13.5A2.25 2.25 0 0 0 7.5 21h6a2.25 2.25 0 0 0 2.25-2.25V15m3 0 3-3m0 0-3-3m3 3H9" />
|
||||
</svg>
|
||||
</a>
|
||||
{{- end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
@@ -84,32 +87,30 @@
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ if .App.RequiresAuth }}
|
||||
<a href="{{ .App.Config.Server.BaseURL }}/logout" class="flex justify-between items-center">
|
||||
<div class="size-h3">Logout</div>
|
||||
<svg class="ui-icon" stroke="var(--color-text-subdue)" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0 0 13.5 3h-6a2.25 2.25 0 0 0-2.25 2.25v13.5A2.25 2.25 0 0 0 7.5 21h6a2.25 2.25 0 0 0 2.25-2.25V15m3 0 3-3m0 0-3-3m3 3H9" />
|
||||
</svg>
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-bounds grow{{ if ne "" .Page.Width }} content-bounds-{{ .Page.Width }} {{ end }}">
|
||||
<div class="content-bounds grow{{ if .Page.Width }} content-bounds-{{ .Page.Width }}{{ end }}">
|
||||
<main class="page{{ if .Page.CenterVertically }} page-center-vertically{{ end }}" id="page" aria-live="polite" aria-busy="true">
|
||||
<h1 class="visually-hidden">{{ .Page.Title }}</h1>
|
||||
<div class="page-content" id="page-content"></div>
|
||||
<div class="page-loading-container">
|
||||
<div class="visually-hidden">Loading</div>
|
||||
<div class="visually-hidden">Loading</div>
|
||||
<div class="loading-icon" aria-hidden="true"></div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
{{ if not .App.Config.Branding.HideFooter }}
|
||||
<footer class="footer flex items-center flex-column">
|
||||
{{ if eq "" .App.Config.Branding.CustomFooter }}
|
||||
<div>
|
||||
<a class="size-h3" href="https://github.com/glanceapp/glance" target="_blank" rel="noreferrer">Glance</a> {{ if ne "dev" .App.Version }}<a class="visited-indicator" title="Release notes" href="https://github.com/glanceapp/glance/releases/tag/{{ .App.Version }}" target="_blank" rel="noreferrer">{{ .App.Version }}</a>{{ else }}({{ .App.Version }}){{ end }}
|
||||
</div>
|
||||
{{ else }}
|
||||
{{ .App.Config.Branding.CustomFooter }}
|
||||
{{ end }}
|
||||
</footer>
|
||||
{{ end }}
|
||||
|
||||
{{ template "footer.html" . }}
|
||||
<div class="mobile-navigation-offset"></div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user