feat: Login 登录接口增加保护机制
#Comment 用户名密码为空时直接返回到登录页面,防止 PostMan 类似软件攻击
This commit is contained in:
parent
60d7f5d5ac
commit
2c92d56547
|
@ -146,6 +146,8 @@ namespace Bootstrap.Admin.Controllers
|
|||
[HttpPost]
|
||||
public async Task<IActionResult> Login(string userName, string password, string remember)
|
||||
{
|
||||
if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password)) return RedirectLogin();
|
||||
|
||||
var auth = UserHelper.Authenticate(userName, password);
|
||||
HttpContext.Log(userName, auth);
|
||||
return auth ? await SignInAsync(userName, remember == "true") : View("Login", new LoginModel() { AuthFailed = true });
|
||||
|
|
Loading…
Reference in New Issue