From 9f99c4f72cdcf81fc4bb21f95948932251874bf3 Mon Sep 17 00:00:00 2001 From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com> Date: Wed, 14 Jun 2023 00:06:23 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20some=20stuff=20(=E2=9D=81=C2=B4=E2=97=A1`?= =?UTF-8?q?=E2=9D=81)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Layouts/LoginLayout.razor | 46 +- .../Elektrifikatsiya/Pages/Admin.razor | 418 ++++++++---------- 2 files changed, 213 insertions(+), 251 deletions(-) diff --git a/src/Elektrifikatsiya/Elektrifikatsiya/Layouts/LoginLayout.razor b/src/Elektrifikatsiya/Elektrifikatsiya/Layouts/LoginLayout.razor index 0055775..0cfd389 100644 --- a/src/Elektrifikatsiya/Elektrifikatsiya/Layouts/LoginLayout.razor +++ b/src/Elektrifikatsiya/Elektrifikatsiya/Layouts/LoginLayout.razor @@ -6,37 +6,37 @@ @inherits LayoutComponentBase - - - - - + + + + + - + @code { - private string username = string.Empty; + private string username = string.Empty; private string password = string.Empty; private Color color = Color.Primary; private bool disabled; - private async Task Clicked() - { - color = Color.Primary; - disabled = true; - - Result loginResult = await AuthenticationService.LoginUserAsync(username, password); + private async Task Clicked() + { + color = Color.Primary; + disabled = true; - if (loginResult.IsSuccess) - { - NavigationManager.NavigateTo("/", true); - } - else - { - color = Color.Danger; - disabled = false; - } - } + Result loginResult = await AuthenticationService.LoginUserAsync(username, password); + + if (loginResult.IsSuccess) + { + NavigationManager.NavigateTo("/", true); + } + else + { + color = Color.Danger; + disabled = false; + } + } } \ No newline at end of file diff --git a/src/Elektrifikatsiya/Elektrifikatsiya/Pages/Admin.razor b/src/Elektrifikatsiya/Elektrifikatsiya/Pages/Admin.razor index 001e646..9209005 100644 --- a/src/Elektrifikatsiya/Elektrifikatsiya/Pages/Admin.razor +++ b/src/Elektrifikatsiya/Elektrifikatsiya/Pages/Admin.razor @@ -14,196 +14,203 @@ @inject IAuthenticationService AuthenthicationService; @inject NavigationManager NavigationManager; @inject MainDatabaseContext MainDatabaseContext; -
- -
- - - - - Users - - - - - - - - - - - - - - - - - - - @context.Item.Name - - - - - Name: @context.Item.Name -
- Rolle: @context.Item.Role -
- E-Mail: @context.Item.Email -
-
+ + +
+ + +
+ + + + + Users - - - - - - - - - Add User - - - - - User Name - - - - User E-Mail - - - - User Password - - - - - - - - - + + + + + + + + + + + + + + + @context.Item.Name + + + + + Name: @context.Item.Name +
+ Rolle: @context.Item.Role +
+ E-Mail: @context.Item.Email +
+
+
+ + + + + + + + + Add User + + + + + User Name + + + + User E-Mail + + + + User Password + + + + + + + + + + +
+
+ + + + + + +
+
+
+
+
+ + @if (SelectedUser is not null) + { + + } + +
+
-
-
- + + + Bro no! this page is only for admins! 😠 + + @code { List users = new List(); @@ -334,49 +341,4 @@ { admin = false; } - public void ValidateName(ValidatorEventArgs e) - { - string? input = Convert.ToString(e.Value); - - if (string.IsNullOrWhiteSpace(input)) - { - e.Status = ValidationStatus.None; - return; - } - else - { - e.Status = ValidationStatus.Success; - return; - } - } - public void ValidateEmail(ValidatorEventArgs e) - { - string? input = Convert.ToString(e.Value); - - if (string.IsNullOrWhiteSpace(input)) - { - e.Status = ValidationStatus.None; - return; - } - else - { - e.Status = ValidationStatus.Success; - return; - } - } - public void ValidatePW(ValidatorEventArgs e) - { - string? input = Convert.ToString(e.Value); - - if (string.IsNullOrWhiteSpace(input)) - { - e.Status = ValidationStatus.None; - return; - } - else - { - e.Status = ValidationStatus.Success; - return; - } - } }