From e6e43b943143d55581ef442b61ed6cbdbb40c642 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Wed, 13 Sep 2023 16:01:02 +1000 Subject: Added logon page --- Pages/Component/Titlebar.razor | 64 ++++++++++++++++++++++++++++++ Pages/Component/Titlebar.razor.css | 79 ++++++++++++++++++++++++++++++++++++++ Pages/Login.razor | 5 +++ Pages/Login.razor.css | 6 +++ Pages/ViewMedia.razor | 2 +- 5 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 Pages/Component/Titlebar.razor create mode 100644 Pages/Component/Titlebar.razor.css create mode 100644 Pages/Login.razor create mode 100644 Pages/Login.razor.css (limited to 'Pages') diff --git a/Pages/Component/Titlebar.razor b/Pages/Component/Titlebar.razor new file mode 100644 index 0000000..71f3bd0 --- /dev/null +++ b/Pages/Component/Titlebar.razor @@ -0,0 +1,64 @@ +@inject IUserService userService +@inject NavigationManager navigationManager +@inject IJSRuntime jsRuntime + +@if(authorized) { + + +} else { + + +} + +@code { + private bool authorized = false; + + private string username; + private string password; + + private AboutDialog aboutDialog; + + private void Login() { + if(userService.Login(username, password)) + navigationManager.NavigateTo("/"); + else + WarnBadLogin(); + } + + private void WarnBadLogin() { + jsRuntime.InvokeVoidAsync("warnBadLogin"); + username = password = ""; + } +} diff --git a/Pages/Component/Titlebar.razor.css b/Pages/Component/Titlebar.razor.css new file mode 100644 index 0000000..ea10740 --- /dev/null +++ b/Pages/Component/Titlebar.razor.css @@ -0,0 +1,79 @@ +div#navbar { + align-items: center; + background: var(--col-navbar-bg); + box-shadow: rgba(0, 0, 0, 0.5) 0px 10px 10px; + display: flex; + height: 59px; + z-index: 100; +} + +div#navbar > h2 { + margin-left: 20px; +} + +div#navbar > a { + align-items: center; + color: white; + display: flex; + height: 100%; + padding: 0 20px 0 20px; +} + +div#navbar > a:hover { + background: rgba(255, 255, 255, 0.4); + filter: none; +} + +div#navbar > a:active { + background: #fff; + color: var(--col-navbar-bg); +} + +p#nsfw-label { + align-self: center; + font-size: 9pt; + margin-left: auto; +} + +div#nsfw-switch { + align-self: center; + margin-left: 10px; +} + +form { + display: flex; + margin: 0 20px 0 20px; + min-width: 30%; +} + +form.login { + margin-left: auto; +} + +form.login.bad-login { + animation-iteration-count: 3; + animation-timing-function: linear; + animation: bad-login 0.2s; +} + +@keyframes bad-login { + 0% { transform: translateX(0); } + 33% { transform: translateX(-20px); } + 66% { transform: translateX(+20px); } + 100% { transform: translateX(0); } +} + +input[type="text"], input[type="password"] { + align-self: center; + background: var(--col-bg); + border-radius: 0; + color: white; + font-size: 12pt; + height: 40px !important; + margin: 0; + width: 100%; +} + +input[type="password"] { + margin-left: 20px; +} diff --git a/Pages/Login.razor b/Pages/Login.razor new file mode 100644 index 0000000..2970731 --- /dev/null +++ b/Pages/Login.razor @@ -0,0 +1,5 @@ +@page "/Login" + +HyperBooru Login + +
\ No newline at end of file diff --git a/Pages/Login.razor.css b/Pages/Login.razor.css new file mode 100644 index 0000000..fc8c8ca --- /dev/null +++ b/Pages/Login.razor.css @@ -0,0 +1,6 @@ +div { + background: url('/images/loginbg.webp'); + filter: brightness(0.6); + height: 100%; + width: 100%; +} \ No newline at end of file diff --git a/Pages/ViewMedia.razor b/Pages/ViewMedia.razor index 444fbc5..1b6f959 100644 --- a/Pages/ViewMedia.razor +++ b/Pages/ViewMedia.razor @@ -4,7 +4,7 @@ @inject IDbContextFactory dbFactory @inject ITagService tagService @inject IMediaService mediaService -@attribute [Authorize] +@*@attribute [Authorize]*@ @title -- cgit v1.3