Browse Source

feat: add ConfigureAwait(false) to all await calls

pull/2500/head
Javier Campos 7 years ago
parent
commit
f1f0a23fd5
  1. 2
      modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs
  2. 34
      modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs
  3. 12
      modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs
  4. 14
      modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs
  5. 2
      modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/LogoutController.cs
  6. 34
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs
  7. 2
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml.cs
  8. 14
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs
  9. 2
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml.cs
  10. 6
      modules/account/test/Volo.Abp.Account.Application.Tests/Volo/Abp/Account/AccountAppService_Tests.cs

2
modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs

@ -19,7 +19,7 @@ namespace Volo.Abp.Account
{ {
var user = new IdentityUser(GuidGenerator.Create(), input.UserName, input.EmailAddress, CurrentTenant.Id); var user = new IdentityUser(GuidGenerator.Create(), input.UserName, input.EmailAddress, CurrentTenant.Id);
(await UserManager.CreateAsync(user, input.Password)).CheckErrors(); (await UserManager.CreateAsync(user, input.Password).ConfigureAwait(false)).CheckErrors();
return ObjectMapper.Map<IdentityUser, IdentityUserDto>(user); return ObjectMapper.Map<IdentityUser, IdentityUserDto>(user);
} }

34
modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs

@ -46,7 +46,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
{ {
LoginInput = new LoginInputModel(); LoginInput = new LoginInputModel();
var context = await Interaction.GetAuthorizationContextAsync(ReturnUrl); var context = await Interaction.GetAuthorizationContextAsync(ReturnUrl).ConfigureAwait(false);
if (context != null) if (context != null)
{ {
@ -68,7 +68,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
return Page(); return Page();
} }
var schemes = await _schemeProvider.GetAllSchemesAsync(); var schemes = await _schemeProvider.GetAllSchemesAsync().ConfigureAwait(false);
var providers = schemes var providers = schemes
.Where(x => x.DisplayName != null || x.Name.Equals(_accountOptions.WindowsAuthenticationSchemeName, StringComparison.OrdinalIgnoreCase)) .Where(x => x.DisplayName != null || x.Name.Equals(_accountOptions.WindowsAuthenticationSchemeName, StringComparison.OrdinalIgnoreCase))
@ -79,10 +79,10 @@ namespace Volo.Abp.Account.Web.Pages.Account
}) })
.ToList(); .ToList();
EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin); EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false);
if (context?.ClientId != null) if (context?.ClientId != null)
{ {
var client = await ClientStore.FindEnabledClientByIdAsync(context.ClientId); var client = await ClientStore.FindEnabledClientByIdAsync(context.ClientId).ConfigureAwait(false);
if (client != null) if (client != null)
{ {
EnableLocalLogin = client.EnableLocalLogin; EnableLocalLogin = client.EnableLocalLogin;
@ -98,7 +98,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
if (IsExternalLoginOnly) if (IsExternalLoginOnly)
{ {
return await base.OnPostExternalLogin(providers.First().AuthenticationScheme); return await base.OnPostExternalLogin(providers.First().AuthenticationScheme).ConfigureAwait(false);
} }
return Page(); return Page();
@ -107,31 +107,31 @@ namespace Volo.Abp.Account.Web.Pages.Account
[UnitOfWork] //TODO: Will be removed when we implement action filter [UnitOfWork] //TODO: Will be removed when we implement action filter
public override async Task<IActionResult> OnPostAsync(string action) public override async Task<IActionResult> OnPostAsync(string action)
{ {
EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin); EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false);
if (action == "Cancel") if (action == "Cancel")
{ {
var context = await Interaction.GetAuthorizationContextAsync(ReturnUrl); var context = await Interaction.GetAuthorizationContextAsync(ReturnUrl).ConfigureAwait(false);
if (context == null) if (context == null)
{ {
return Redirect("~/"); return Redirect("~/");
} }
await Interaction.GrantConsentAsync(context, ConsentResponse.Denied); await Interaction.GrantConsentAsync(context, ConsentResponse.Denied).ConfigureAwait(false);
return Redirect(ReturnUrl); return Redirect(ReturnUrl);
} }
ValidateModel(); ValidateModel();
await ReplaceEmailToUsernameOfInputIfNeeds(); await ReplaceEmailToUsernameOfInputIfNeeds().ConfigureAwait(false);
var result = await SignInManager.PasswordSignInAsync( var result = await SignInManager.PasswordSignInAsync(
LoginInput.UserNameOrEmailAddress, LoginInput.UserNameOrEmailAddress,
LoginInput.Password, LoginInput.Password,
LoginInput.RememberMe, LoginInput.RememberMe,
true true
); ).ConfigureAwait(false);
if (result.RequiresTwoFactor) if (result.RequiresTwoFactor)
{ {
@ -162,11 +162,11 @@ namespace Volo.Abp.Account.Web.Pages.Account
} }
//TODO: Find a way of getting user's id from the logged in user and do not query it again like that! //TODO: Find a way of getting user's id from the logged in user and do not query it again like that!
var user = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress) ?? var user = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false) ??
await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress); await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false);
Debug.Assert(user != null, nameof(user) + " != null"); Debug.Assert(user != null, nameof(user) + " != null");
await IdentityServerEvents.RaiseAsync(new UserLoginSuccessEvent(user.UserName, user.Id.ToString(), user.UserName)); //TODO: Use user's name once implemented await IdentityServerEvents.RaiseAsync(new UserLoginSuccessEvent(user.UserName, user.Id.ToString(), user.UserName)).ConfigureAwait(false); //TODO: Use user's name once implemented
return RedirectSafely(ReturnUrl, ReturnUrlHash); return RedirectSafely(ReturnUrl, ReturnUrlHash);
} }
@ -176,15 +176,15 @@ namespace Volo.Abp.Account.Web.Pages.Account
{ {
if (_accountOptions.WindowsAuthenticationSchemeName == provider) if (_accountOptions.WindowsAuthenticationSchemeName == provider)
{ {
return await ProcessWindowsLoginAsync(); return await ProcessWindowsLoginAsync().ConfigureAwait(false);
} }
return await base.OnPostExternalLogin(provider); return await base.OnPostExternalLogin(provider).ConfigureAwait(false);
} }
private async Task<IActionResult> ProcessWindowsLoginAsync() private async Task<IActionResult> ProcessWindowsLoginAsync()
{ {
var result = await HttpContext.AuthenticateAsync(_accountOptions.WindowsAuthenticationSchemeName); var result = await HttpContext.AuthenticateAsync(_accountOptions.WindowsAuthenticationSchemeName).ConfigureAwait(false);
if (!(result?.Principal is WindowsPrincipal windowsPrincipal)) if (!(result?.Principal is WindowsPrincipal windowsPrincipal))
{ {
return Challenge(_accountOptions.WindowsAuthenticationSchemeName); return Challenge(_accountOptions.WindowsAuthenticationSchemeName);
@ -219,7 +219,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
IdentityServer4.IdentityServerConstants.ExternalCookieAuthenticationScheme, IdentityServer4.IdentityServerConstants.ExternalCookieAuthenticationScheme,
new ClaimsPrincipal(identity), new ClaimsPrincipal(identity),
props props
); ).ConfigureAwait(false);
return RedirectSafely(props.RedirectUri); return RedirectSafely(props.RedirectUri);
} }

12
modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs

@ -44,19 +44,19 @@ namespace Volo.Abp.Account.Web.Pages
public virtual async Task OnGet() public virtual async Task OnGet()
{ {
var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl); var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl).ConfigureAwait(false);
if (request == null) if (request == null)
{ {
throw new ApplicationException($"No consent request matching request: {ReturnUrl}"); throw new ApplicationException($"No consent request matching request: {ReturnUrl}");
} }
var client = await _clientStore.FindEnabledClientByIdAsync(request.ClientId); var client = await _clientStore.FindEnabledClientByIdAsync(request.ClientId).ConfigureAwait(false);
if (client == null) if (client == null)
{ {
throw new ApplicationException($"Invalid client id: {request.ClientId}"); throw new ApplicationException($"Invalid client id: {request.ClientId}");
} }
var resources = await _resourceStore.FindEnabledResourcesByScopeAsync(request.ScopesRequested); var resources = await _resourceStore.FindEnabledResourcesByScopeAsync(request.ScopesRequested).ConfigureAwait(false);
if (resources == null || (!resources.IdentityResources.Any() && !resources.ApiResources.Any())) if (resources == null || (!resources.IdentityResources.Any() && !resources.ApiResources.Any()))
{ {
throw new ApplicationException($"No scopes matching: {request.ScopesRequested.Aggregate((x, y) => x + ", " + y)}"); throw new ApplicationException($"No scopes matching: {request.ScopesRequested.Aggregate((x, y) => x + ", " + y)}");
@ -78,7 +78,7 @@ namespace Volo.Abp.Account.Web.Pages
public virtual async Task<IActionResult> OnPost(string userDecision) public virtual async Task<IActionResult> OnPost(string userDecision)
{ {
var result = await ProcessConsentAsync(); var result = await ProcessConsentAsync().ConfigureAwait(false);
if (result.IsRedirect) if (result.IsRedirect)
{ {
@ -122,13 +122,13 @@ namespace Volo.Abp.Account.Web.Pages
if (grantedConsent != null) if (grantedConsent != null)
{ {
var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl); var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl).ConfigureAwait(false);
if (request == null) if (request == null)
{ {
return result; return result;
} }
await _interaction.GrantConsentAsync(request, grantedConsent); await _interaction.GrantConsentAsync(request, grantedConsent).ConfigureAwait(false);
result.RedirectUri = ReturnUrl; //TODO: ReturnUrlHash? result.RedirectUri = ReturnUrl; //TODO: ReturnUrlHash?
} }

14
modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs

@ -34,14 +34,14 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers
{ {
ValidateLoginInfo(login); ValidateLoginInfo(login);
await ReplaceEmailToUsernameOfInputIfNeeds(login); await ReplaceEmailToUsernameOfInputIfNeeds(login).ConfigureAwait(false);
return GetAbpLoginResult(await _signInManager.PasswordSignInAsync( return GetAbpLoginResult(await _signInManager.PasswordSignInAsync(
login.UserNameOrEmailAddress, login.UserNameOrEmailAddress,
login.Password, login.Password,
login.RememberMe, login.RememberMe,
true true
)); ).ConfigureAwait(false));
} }
[HttpPost] [HttpPost]
@ -50,16 +50,16 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers
{ {
ValidateLoginInfo(login); ValidateLoginInfo(login);
await ReplaceEmailToUsernameOfInputIfNeeds(login); await ReplaceEmailToUsernameOfInputIfNeeds(login).ConfigureAwait(false);
var identityUser = await _userManager.FindByNameAsync(login.UserNameOrEmailAddress); var identityUser = await _userManager.FindByNameAsync(login.UserNameOrEmailAddress).ConfigureAwait(false);
if (identityUser == null) if (identityUser == null)
{ {
return new AbpLoginResult(LoginResultType.InvalidUserNameOrPassword); return new AbpLoginResult(LoginResultType.InvalidUserNameOrPassword);
} }
return GetAbpLoginResult(await _signInManager.CheckPasswordSignInAsync(identityUser, login.Password, true)); return GetAbpLoginResult(await _signInManager.CheckPasswordSignInAsync(identityUser, login.Password, true).ConfigureAwait(false));
} }
protected virtual async Task ReplaceEmailToUsernameOfInputIfNeeds(UserLoginInfo login) protected virtual async Task ReplaceEmailToUsernameOfInputIfNeeds(UserLoginInfo login)
@ -69,13 +69,13 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers
return; return;
} }
var userByUsername = await _userManager.FindByNameAsync(login.UserNameOrEmailAddress); var userByUsername = await _userManager.FindByNameAsync(login.UserNameOrEmailAddress).ConfigureAwait(false);
if (userByUsername != null) if (userByUsername != null)
{ {
return; return;
} }
var userByEmail = await _userManager.FindByEmailAsync(login.UserNameOrEmailAddress); var userByEmail = await _userManager.FindByEmailAsync(login.UserNameOrEmailAddress).ConfigureAwait(false);
if (userByEmail == null) if (userByEmail == null)
{ {
return; return;

2
modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/LogoutController.cs

@ -19,7 +19,7 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers
//todo@alper: this method can be moved to AccountController like "account/logout" //todo@alper: this method can be moved to AccountController like "account/logout"
public async Task<IActionResult> Index(string returnUrl = null) public async Task<IActionResult> Index(string returnUrl = null)
{ {
await _signInManager.SignOutAsync(); await _signInManager.SignOutAsync().ConfigureAwait(false);
if (returnUrl != null) if (returnUrl != null)
{ {

34
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs

@ -62,7 +62,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
{ {
LoginInput = new LoginInputModel(); LoginInput = new LoginInputModel();
var schemes = await _schemeProvider.GetAllSchemesAsync(); var schemes = await _schemeProvider.GetAllSchemesAsync().ConfigureAwait(false);
var providers = schemes var providers = schemes
.Where(x => x.DisplayName != null || x.Name.Equals(_accountOptions.WindowsAuthenticationSchemeName, StringComparison.OrdinalIgnoreCase)) .Where(x => x.DisplayName != null || x.Name.Equals(_accountOptions.WindowsAuthenticationSchemeName, StringComparison.OrdinalIgnoreCase))
@ -73,7 +73,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
}) })
.ToList(); .ToList();
EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin); EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false);
ExternalProviders = providers.ToArray(); ExternalProviders = providers.ToArray();
@ -89,18 +89,18 @@ namespace Volo.Abp.Account.Web.Pages.Account
[UnitOfWork] //TODO: Will be removed when we implement action filter [UnitOfWork] //TODO: Will be removed when we implement action filter
public virtual async Task<IActionResult> OnPostAsync(string action) public virtual async Task<IActionResult> OnPostAsync(string action)
{ {
EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin); EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false);
ValidateModel(); ValidateModel();
await ReplaceEmailToUsernameOfInputIfNeeds(); await ReplaceEmailToUsernameOfInputIfNeeds().ConfigureAwait(false);
var result = await SignInManager.PasswordSignInAsync( var result = await SignInManager.PasswordSignInAsync(
LoginInput.UserNameOrEmailAddress, LoginInput.UserNameOrEmailAddress,
LoginInput.Password, LoginInput.Password,
LoginInput.RememberMe, LoginInput.RememberMe,
true true
); ).ConfigureAwait(false);
if (result.RequiresTwoFactor) if (result.RequiresTwoFactor)
{ {
@ -131,8 +131,8 @@ namespace Volo.Abp.Account.Web.Pages.Account
} }
//TODO: Find a way of getting user's id from the logged in user and do not query it again like that! //TODO: Find a way of getting user's id from the logged in user and do not query it again like that!
var user = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress) ?? var user = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false) ??
await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress); await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false);
Debug.Assert(user != null, nameof(user) + " != null"); Debug.Assert(user != null, nameof(user) + " != null");
@ -163,7 +163,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
return RedirectToPage("./Login"); return RedirectToPage("./Login");
} }
var loginInfo = await SignInManager.GetExternalLoginInfoAsync(); var loginInfo = await SignInManager.GetExternalLoginInfoAsync().ConfigureAwait(false);
if (loginInfo == null) if (loginInfo == null)
{ {
Logger.LogWarning("External login info is not available"); Logger.LogWarning("External login info is not available");
@ -175,7 +175,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
loginInfo.ProviderKey, loginInfo.ProviderKey,
isPersistent: false, isPersistent: false,
bypassTwoFactor: true bypassTwoFactor: true
); ).ConfigureAwait(false);
if (result.IsLockedOut) if (result.IsLockedOut)
{ {
@ -190,15 +190,15 @@ namespace Volo.Abp.Account.Web.Pages.Account
//TODO: Handle other cases for result! //TODO: Handle other cases for result!
// Get the information about the user from the external login provider // Get the information about the user from the external login provider
var info = await SignInManager.GetExternalLoginInfoAsync(); var info = await SignInManager.GetExternalLoginInfoAsync().ConfigureAwait(false);
if (info == null) if (info == null)
{ {
throw new ApplicationException("Error loading external login information during confirmation."); throw new ApplicationException("Error loading external login information during confirmation.");
} }
var user = await CreateExternalUserAsync(info); var user = await CreateExternalUserAsync(info).ConfigureAwait(false);
await SignInManager.SignInAsync(user, false); await SignInManager.SignInAsync(user, false).ConfigureAwait(false);
return RedirectSafely(returnUrl, returnUrlHash); return RedirectSafely(returnUrl, returnUrlHash);
} }
@ -208,9 +208,9 @@ namespace Volo.Abp.Account.Web.Pages.Account
var user = new IdentityUser(GuidGenerator.Create(), emailAddress, emailAddress, CurrentTenant.Id); var user = new IdentityUser(GuidGenerator.Create(), emailAddress, emailAddress, CurrentTenant.Id);
CheckIdentityErrors(await UserManager.CreateAsync(user)); CheckIdentityErrors(await UserManager.CreateAsync(user).ConfigureAwait(false));
CheckIdentityErrors(await UserManager.SetEmailAsync(user, emailAddress)); CheckIdentityErrors(await UserManager.SetEmailAsync(user, emailAddress).ConfigureAwait(false));
CheckIdentityErrors(await UserManager.AddLoginAsync(user, info)); CheckIdentityErrors(await UserManager.AddLoginAsync(user, info).ConfigureAwait(false));
return user; return user;
} }
@ -222,13 +222,13 @@ namespace Volo.Abp.Account.Web.Pages.Account
return; return;
} }
var userByUsername = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress); var userByUsername = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false);
if (userByUsername != null) if (userByUsername != null)
{ {
return; return;
} }
var userByEmail = await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress); var userByEmail = await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false);
if (userByEmail == null) if (userByEmail == null)
{ {
return; return;

2
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml.cs

@ -19,7 +19,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
public async Task OnGetAsync() public async Task OnGetAsync()
{ {
var user = await _profileAppService.GetAsync(); var user = await _profileAppService.GetAsync().ConfigureAwait(false);
PersonalSettingsInfoModel = ObjectMapper.Map<ProfileDto, PersonalSettingsInfoModel>(user); PersonalSettingsInfoModel = ObjectMapper.Map<ProfileDto, PersonalSettingsInfoModel>(user);
} }

14
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs

@ -22,7 +22,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
public virtual async Task OnGet() public virtual async Task OnGet()
{ {
await CheckSelfRegistrationAsync(); await CheckSelfRegistrationAsync().ConfigureAwait(false);
} }
[UnitOfWork] //TODO: Will be removed when we implement action filter [UnitOfWork] //TODO: Will be removed when we implement action filter
@ -30,22 +30,22 @@ namespace Volo.Abp.Account.Web.Pages.Account
{ {
ValidateModel(); ValidateModel();
await CheckSelfRegistrationAsync(); await CheckSelfRegistrationAsync().ConfigureAwait(false);
var user = new IdentityUser(GuidGenerator.Create(), Input.UserName, Input.EmailAddress, CurrentTenant.Id); var user = new IdentityUser(GuidGenerator.Create(), Input.UserName, Input.EmailAddress, CurrentTenant.Id);
(await UserManager.CreateAsync(user, Input.Password)).CheckErrors(); (await UserManager.CreateAsync(user, Input.Password).ConfigureAwait(false)).CheckErrors();
await UserManager.SetEmailAsync(user, Input.EmailAddress); await UserManager.SetEmailAsync(user, Input.EmailAddress).ConfigureAwait(false);
await SignInManager.SignInAsync(user, isPersistent: false); await SignInManager.SignInAsync(user, isPersistent: false).ConfigureAwait(false);
return Redirect(ReturnUrl ?? "/"); //TODO: How to ensure safety? IdentityServer requires it however it should be checked somehow! return Redirect(ReturnUrl ?? "/"); //TODO: How to ensure safety? IdentityServer requires it however it should be checked somehow!
} }
protected virtual async Task CheckSelfRegistrationAsync() protected virtual async Task CheckSelfRegistrationAsync()
{ {
if (!await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled)) if (!await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled).ConfigureAwait(false))
{ {
throw new UserFriendlyException(L["SelfRegistrationDisabledMessage"]); throw new UserFriendlyException(L["SelfRegistrationDisabledMessage"]);
} }

2
modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml.cs

@ -14,7 +14,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
public async Task<IActionResult> OnGetAsync() public async Task<IActionResult> OnGetAsync()
{ {
var user = await SignInManager.GetTwoFactorAuthenticationUserAsync(); var user = await SignInManager.GetTwoFactorAuthenticationUserAsync().ConfigureAwait(false);
if (user == null) if (user == null)
{ {
return RedirectToPage("./Login"); return RedirectToPage("./Login");

6
modules/account/test/Volo.Abp.Account.Application.Tests/Volo/Abp/Account/AccountAppService_Tests.cs

@ -33,16 +33,16 @@ namespace Volo.Abp.Account.Pro.Application.Tests.Volo.Abp.Account
AppName = "MVC" AppName = "MVC"
}; };
await _accountAppService.RegisterAsync(registerDto); await _accountAppService.RegisterAsync(registerDto).ConfigureAwait(false);
var user = await _identityUserRepository.FindByNormalizedUserNameAsync( var user = await _identityUserRepository.FindByNormalizedUserNameAsync(
_lookupNormalizer.NormalizeName("bob.lee")); _lookupNormalizer.NormalizeName("bob.lee")).ConfigureAwait(false);
user.ShouldNotBeNull(); user.ShouldNotBeNull();
user.UserName.ShouldBe("bob.lee"); user.UserName.ShouldBe("bob.lee");
user.Email.ShouldBe("bob.lee@abp.io"); user.Email.ShouldBe("bob.lee@abp.io");
(await _userManager.CheckPasswordAsync(user, "P@ssW0rd")).ShouldBeTrue(); (await _userManager.CheckPasswordAsync(user, "P@ssW0rd").ConfigureAwait(false)).ShouldBeTrue();
} }
} }
} }

Loading…
Cancel
Save