From 48719352584672175a877a5bc8c2360761d154eb Mon Sep 17 00:00:00 2001 From: GeeSuth Date: Wed, 20 Nov 2024 00:15:29 +0300 Subject: [PATCH 1/3] use MapStaticAssets() instead UseStaticFiles() --- Todo.Web/Server/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Todo.Web/Server/Program.cs b/Todo.Web/Server/Program.cs index 2825e92..65d29d8 100644 --- a/Todo.Web/Server/Program.cs +++ b/Todo.Web/Server/Program.cs @@ -40,7 +40,7 @@ } app.UseHttpsRedirection(); -app.UseStaticFiles(); +app.MapStaticAssets(); app.UseAntiforgery(); app.MapRazorComponents() From d910f165a779222a02d559a26f0dbfc0755c09f3 Mon Sep 17 00:00:00 2001 From: GeeSuth Date: Wed, 20 Nov 2024 00:34:37 +0300 Subject: [PATCH 2/3] clarify email as required with register/login #95 --- Todo.Web/Client/Components/LogInForm.razor | 18 +++++++++--------- Todo.Web/Client/TodoClient.cs | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Todo.Web/Client/Components/LogInForm.razor b/Todo.Web/Client/Components/LogInForm.razor index ecd7250..39afffd 100644 --- a/Todo.Web/Client/Components/LogInForm.razor +++ b/Todo.Web/Client/Components/LogInForm.razor @@ -3,9 +3,9 @@
- - - + + +
@@ -34,8 +34,8 @@ string? alertMessage; [Required] - [StringLength(15)] - public string? Username { get; set; } + [StringLength(256)] + public string? Email { get; set; } [Required] [StringLength(32, MinimumLength = 6, ErrorMessage = "The password must be between 6 and 32 characters long.")] @@ -53,9 +53,9 @@ async Task Login() { alertMessage = null; - if (await Client.LoginAsync(Username, Password)) + if (await Client.LoginAsync(Email, Password)) { - await OnLoggedIn.InvokeAsync(Username); + await OnLoggedIn.InvokeAsync(Email); } else { @@ -66,9 +66,9 @@ async Task Create() { alertMessage = null; - if (await Client.CreateUserAsync(Username, Password)) + if (await Client.CreateUserAsync(Email, Password)) { - await OnLoggedIn.InvokeAsync(Username); + await OnLoggedIn.InvokeAsync(Email); } else { diff --git a/Todo.Web/Client/TodoClient.cs b/Todo.Web/Client/TodoClient.cs index 151dfb3..69e60a7 100644 --- a/Todo.Web/Client/TodoClient.cs +++ b/Todo.Web/Client/TodoClient.cs @@ -50,25 +50,25 @@ public async Task DeleteTodoAsync(int id) return (statusCode, todos); } - public async Task LoginAsync(string? username, string? password) + public async Task LoginAsync(string? email, string? password) { - if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) + if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password)) { return false; } - var response = await client.PostAsJsonAsync("auth/login", new UserInfo { Email = username, Password = password }); + var response = await client.PostAsJsonAsync("auth/login", new UserInfo { Email = email, Password = password }); return response.IsSuccessStatusCode; } - public async Task CreateUserAsync(string? username, string? password) + public async Task CreateUserAsync(string? email, string? password) { - if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) + if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password)) { return false; } - var response = await client.PostAsJsonAsync("auth/register", new UserInfo { Email = username, Password = password }); + var response = await client.PostAsJsonAsync("auth/register", new UserInfo { Email = email, Password = password }); return response.IsSuccessStatusCode; } From c4b34b8dd53c6561979eede996de38d9be2ea686 Mon Sep 17 00:00:00 2001 From: Abdallh Bin Hatheem Ali Date: Fri, 22 Nov 2024 18:12:42 +0300 Subject: [PATCH 3/3] order MapStaticAssets() after Use* --- .vscode/launch.json | 4 ++-- Todo.Web/Server/Program.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index dcdc84e..c5fbd1e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -15,7 +15,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/Todo.Web/Server/bin/Debug/net8.0/Todo.Web.Server.dll", + "program": "${workspaceFolder}/Todo.Web/Server/bin/Debug/net9.0/Todo.Web.Server.dll", "args": [], "cwd": "${workspaceFolder}/Todo.Web/Server", "launchSettingsProfile": "https", @@ -37,7 +37,7 @@ "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/TodoApi/bin/Debug/net8.0/TodoApi.dll", + "program": "${workspaceFolder}/TodoApi/bin/Debug/net9.0/TodoApi.dll", "args": [], "cwd": "${workspaceFolder}/TodoApi", "stopAtEntry": false, diff --git a/Todo.Web/Server/Program.cs b/Todo.Web/Server/Program.cs index 65d29d8..c28a1bb 100644 --- a/Todo.Web/Server/Program.cs +++ b/Todo.Web/Server/Program.cs @@ -40,9 +40,9 @@ } app.UseHttpsRedirection(); -app.MapStaticAssets(); app.UseAntiforgery(); +app.MapStaticAssets(); app.MapRazorComponents() .AddInteractiveWebAssemblyRenderMode();