Fix login: Make username parameter case-insensitive
- Changed parameter names to uppercase (Username, Password) - Convert to lowercase internally for consistency - Fixes HTTP 500 error when form submits with lowercase field names
This commit is contained in:
parent
069930fe40
commit
0f9e92130c
@ -29,8 +29,12 @@ public class AccountController : Controller
|
||||
|
||||
[HttpPost]
|
||||
// [ValidateAntiForgeryToken] // Temporarily disabled for HTTPS proxy issue
|
||||
public async Task<IActionResult> Login(string username, string password)
|
||||
public async Task<IActionResult> Login(string Username, string Password)
|
||||
{
|
||||
// Make parameters case-insensitive for form compatibility
|
||||
var username = Username?.ToLowerInvariant();
|
||||
var password = Password;
|
||||
|
||||
Console.WriteLine($"Received Username: '{username}', Password: '{password}'");
|
||||
|
||||
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
|
||||
@ -39,8 +43,8 @@ public class AccountController : Controller
|
||||
return View();
|
||||
}
|
||||
|
||||
// Use AuthService to validate against database users
|
||||
var loginDto = new LoginDto { Username = username, Password = password };
|
||||
// Use AuthService to validate against database users (username already lowercase)
|
||||
var loginDto = new LoginDto { Username = username!, Password = password };
|
||||
var authResponse = await _authService.LoginAsync(loginDto);
|
||||
|
||||
if (authResponse != null)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user