From 3a6ffaec4615472d7d7af81cba414b5495a2affb Mon Sep 17 00:00:00 2001 From: limited_dev Date: Wed, 31 May 2023 14:13:18 +0200 Subject: [PATCH] feat: improved login and register, improved sidebar Signed-off-by: limited_dev --- .../Pages/Accounts/Login.razor | 44 ++++-------- .../Pages/Accounts/Register.razor | 36 +++++----- .../Pages/Accounts/Register.razor.css | 11 +++ ImageBoardServerApp/Pages/_Host.cshtml | 2 +- .../Shared/Components/Forms/PostForm.razor | 6 +- .../Shared/Components/Post.razor | 38 ++++++++--- ImageBoardServerApp/Shared/MainLayout.razor | 17 +---- .../Shared/MainLayout.razor.css | 3 +- ImageBoardServerApp/Shared/NavMenu.razor | 64 ++++++++++++------ ImageBoardServerApp/Shared/NavMenu.razor.css | 23 ++++++- .../wwwroot/img/static/logo_trans.png | Bin 0 -> 138396 bytes 11 files changed, 147 insertions(+), 97 deletions(-) create mode 100644 ImageBoardServerApp/wwwroot/img/static/logo_trans.png diff --git a/ImageBoardServerApp/Pages/Accounts/Login.razor b/ImageBoardServerApp/Pages/Accounts/Login.razor index 4f960a8..1b301ed 100644 --- a/ImageBoardServerApp/Pages/Accounts/Login.razor +++ b/ImageBoardServerApp/Pages/Accounts/Login.razor @@ -9,27 +9,16 @@

Login to bulletbroards

@@ -38,25 +27,20 @@ private bool verified; - class Model - { - public string Email { get; set; } - public string Password { get; set; } - } - - Model model = new Model(); + public string Email { get; set; } + public string Password { get; set; } private async Task login() { Console.WriteLine("loggin you in..."); - var user = await UsersRepository.getUserByEmailRawAsync(model.Email); + var user = await UsersRepository.getUserByEmailRawAsync(Email); if (user == null) { await js.InvokeVoidAsync("alert", "User does not exist"); verified = false; return; } - verified = BCrypt.Net.BCrypt.Verify(model.Password, user.Password); + verified = BCrypt.Net.BCrypt.Verify(Password, user.Password); if (verified) { verified = true; diff --git a/ImageBoardServerApp/Pages/Accounts/Register.razor b/ImageBoardServerApp/Pages/Accounts/Register.razor index 6ee203a..f16a907 100644 --- a/ImageBoardServerApp/Pages/Accounts/Register.razor +++ b/ImageBoardServerApp/Pages/Accounts/Register.razor @@ -5,33 +5,38 @@ @inject AuthenticationStateProvider authStateProvider @inject NavigationManager navManager -

Register to bulletbroards

-
+ -By registering you confirm that you are atleast 18 years of age. - - @code { private string Email { get; set; } private string Password { get; set; } + private bool is18 { get; set; } + + private string msg { get; set; } private bool verified; private async Task login() { + if (!is18) + return; Console.WriteLine("Registering..."); UserData userToCreate = new UserData() { @@ -64,7 +69,4 @@ } await js.InvokeVoidAsync("alert", $"Wrong Password"); } -} -@code { - } \ No newline at end of file diff --git a/ImageBoardServerApp/Pages/Accounts/Register.razor.css b/ImageBoardServerApp/Pages/Accounts/Register.razor.css index e69de29..1b050a0 100644 --- a/ImageBoardServerApp/Pages/Accounts/Register.razor.css +++ b/ImageBoardServerApp/Pages/Accounts/Register.razor.css @@ -0,0 +1,11 @@ +.headLogin{ + text-align: center; + -webkit-text-size-adjust: auto; +} +.login{ + text-align: center; + align-items:center; + font-style: unset;} +.gaping{ + alignment: left; +} \ No newline at end of file diff --git a/ImageBoardServerApp/Pages/_Host.cshtml b/ImageBoardServerApp/Pages/_Host.cshtml index 8811430..6355623 100644 --- a/ImageBoardServerApp/Pages/_Host.cshtml +++ b/ImageBoardServerApp/Pages/_Host.cshtml @@ -15,7 +15,7 @@ - + diff --git a/ImageBoardServerApp/Shared/Components/Forms/PostForm.razor b/ImageBoardServerApp/Shared/Components/Forms/PostForm.razor index eb149db..b126e06 100644 --- a/ImageBoardServerApp/Shared/Components/Forms/PostForm.razor +++ b/ImageBoardServerApp/Shared/Components/Forms/PostForm.razor @@ -31,9 +31,9 @@
@if (hasErr) - { - @postErr - } + { + @postErr + }
diff --git a/ImageBoardServerApp/Shared/Components/Post.razor b/ImageBoardServerApp/Shared/Components/Post.razor index aa07b3e..75d440e 100644 --- a/ImageBoardServerApp/Shared/Components/Post.razor +++ b/ImageBoardServerApp/Shared/Components/Post.razor @@ -53,15 +53,36 @@ }
- @foreach (string s in @post.Content.Split("\n")) + @if (showOpenThread) { - var className = ""; - @if (s.StartsWith(">") && !Regex.IsMatch(s, "^>{2,}")) + @foreach (string s in post.Content.Split("\n").ToList().Take(6)) { - className = "greenText"; + var className = ""; + @if (s.StartsWith(">") && !Regex.IsMatch(s, "^>{2,}")) + { + className = "greenText"; + } + + @s  } - - @s  + @if (post.Content.Split("\n").Length > 6) + { +
+ [Open Thread to read more...] + } + } + else + { + @foreach (string s in post.Content.Split("\n")) + { + var className = ""; + @if (s.StartsWith(">") && !Regex.IsMatch(s, "^>{2,}")) + { + className = "greenText"; + } + + @s  + } }
@@ -117,12 +138,13 @@ } - - @code { public bool canDel { get; set; } public bool isActive { get; set; } = false; + + private int linecnt = 0; + private async void lockMe() { diff --git a/ImageBoardServerApp/Shared/MainLayout.razor b/ImageBoardServerApp/Shared/MainLayout.razor index 25cde22..3457b28 100644 --- a/ImageBoardServerApp/Shared/MainLayout.razor +++ b/ImageBoardServerApp/Shared/MainLayout.razor @@ -1,5 +1,5 @@ -@inherits LayoutComponentBase -@using ImageBoardServerApp.Auth +@using ImageBoardServerApp.Auth +@inherits LayoutComponentBase @inject AuthenticationStateProvider authStateProvider @inject NavigationManager navManager @@ -11,12 +11,6 @@
- -
- [FAQ] - [Rules] -
-
@Body
@@ -37,11 +31,4 @@ mail = user.User.Identity.Name; } } - - private async Task logout() - { - var customAuthStateProvider = (CustomAuthenticationStateProvider) authStateProvider; - await customAuthStateProvider.UpdateAuthenticationStateAsync(null); - navManager.NavigateTo("/", true); - } } diff --git a/ImageBoardServerApp/Shared/MainLayout.razor.css b/ImageBoardServerApp/Shared/MainLayout.razor.css index 3d21ab5..56760ef 100644 --- a/ImageBoardServerApp/Shared/MainLayout.razor.css +++ b/ImageBoardServerApp/Shared/MainLayout.razor.css @@ -13,11 +13,10 @@ main { } .sidebar { - background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); + background-image: linear-gradient(180deg, #0f081b, #0f081b 70%); } .top-row { - border-bottom: 1px solid #f8f8f2; justify-content: flex-end; height: 3.5rem; diff --git a/ImageBoardServerApp/Shared/NavMenu.razor b/ImageBoardServerApp/Shared/NavMenu.razor index ff5e9ab..033bbfe 100644 --- a/ImageBoardServerApp/Shared/NavMenu.razor +++ b/ImageBoardServerApp/Shared/NavMenu.razor @@ -5,7 +5,8 @@