* Fix login.cshtml
This commit is contained in:
Hao Kung 2018-10-12 11:34:54 -07:00 коммит произвёл GitHub
Родитель f5b5018d66
Коммит 44f00013cd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 22 добавлений и 4 удалений

Просмотреть файл

@ -128,7 +128,7 @@ namespace Microsoft.AspNetCore.Identity.UI.V3.Pages.Account.Internal
{
// This doesn't count login failures towards account lockout
// To enable password failures to trigger account lockout, set lockoutOnFailure: true
var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: true);
var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: false);
if (result.Succeeded)
{
_logger.LogInformation("User logged in.");

Просмотреть файл

@ -127,7 +127,7 @@ namespace Microsoft.AspNetCore.Identity.UI.V4.Pages.Account.Internal
{
// This doesn't count login failures towards account lockout
// To enable password failures to trigger account lockout, set lockoutOnFailure: true
var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: true);
var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: false);
if (result.Succeeded)
{
_logger.LogInformation("User logged in.");

Просмотреть файл

@ -362,7 +362,7 @@ namespace Microsoft.AspNetCore.Identity.FunctionalTests
}
[Fact]
public async Task UserLockedOut_AfterMaxFailedAccessAttempts_WithGlobalAuthorizeFilter()
public async Task UserNotLockedOut_AfterMaxFailedAccessAttempts_WithGlobalAuthorizeFilter()
{
// Arrange
var emailSender = new ContosoEmailSender();
@ -383,7 +383,7 @@ namespace Microsoft.AspNetCore.Identity.FunctionalTests
await UserStories.ConfirmEmailAsync(registrationEmail, client);
// Act & Assert
await UserStories.LockoutExistingUserAsync(newClient, userName, wrongPassword);
await UserStories.LoginFailsWithWrongPasswordAsync(newClient, userName, wrongPassword);
}
}
}

Просмотреть файл

@ -64,6 +64,15 @@ namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account
Context.WithAuthenticatedUser().WithPasswordLogin());
}
public async Task LoginWrongPasswordAsync(string userName, string password)
{
var failedLogin = await SendLoginForm(userName, password);
ResponseAssert.IsOK(failedLogin);
var content = await failedLogin.Content.ReadAsStringAsync();
Assert.Contains("Invalid login attempt.", content);
}
public async Task<DefaultUIPage> LockoutUserAsync(string userName, string password)
{
var loginAttempt = await SendLoginForm(userName, password);

Просмотреть файл

@ -36,6 +36,15 @@ namespace Microsoft.AspNetCore.Identity.FunctionalTests
return await login.LoginValidUserAsync(userName, password);
}
internal static async Task LoginFailsWithWrongPasswordAsync(HttpClient client, string userName, string password)
{
var index = await Index.CreateAsync(client);
var login = await index.ClickLoginLinkAsync();
await login.LoginWrongPasswordAsync(userName, password);
}
internal static async Task<DefaultUIPage> LockoutExistingUserAsync(HttpClient client, string userName, string password)
{
var index = await Index.CreateAsync(client);