public virtual async Task <AbpLoginResult> CheckPassword(UserLoginInfo login) { ValidateLoginInfo(login); var identityUser = await _userManager.FindByNameAsync(login.UserNameOrEmailAddress); return(GetAbpLoginResult(await _signInManager.CheckPasswordSignInAsync(identityUser, login.Password, true))); }
public virtual async Task <AbpLoginResult> Login(UserLoginInfo login) { ValidateLoginInfo(login); return(GetAbpLoginResult(await _signInManager.PasswordSignInAsync( login.UserNameOrEmailAddress, login.Password, login.RememberMe, true ))); }
public virtual async Task <AbpLoginResult> Login(UserLoginInfo login) { ValidateLoginInfo(login); await ReplaceEmailToUsernameOfInputIfNeeds(login).ConfigureAwait(false); return(GetAbpLoginResult(await _signInManager.PasswordSignInAsync( login.UserNameOrEmailAddress, login.Password, login.RememberMe, true ).ConfigureAwait(false))); }
public virtual async Task <AbpLoginResult> CheckPassword(UserLoginInfo login) { ValidateLoginInfo(login); await ReplaceEmailToUsernameOfInputIfNeeds(login); var identityUser = await _userManager.FindByNameAsync(login.UserNameOrEmailAddress); if (identityUser == null) { return(new AbpLoginResult(LoginResultType.InvalidUserNameOrPassword)); } return(GetAbpLoginResult(await _signInManager.CheckPasswordSignInAsync(identityUser, login.Password, true))); }
public virtual async Task <AbpLoginResult> Login(UserLoginInfo login) { await CheckLocalLoginAsync(); ValidateLoginInfo(login); await ReplaceEmailToUsernameOfInputIfNeeds(login); return(GetAbpLoginResult(await SignInManager.PasswordSignInAsync( login.UserNameOrEmailAddress, login.Password, login.RememberMe, true ))); }
private void ValidateLoginInfo(UserLoginInfo login) { if (login == null) { throw new ArgumentException(nameof(login)); } if (login.UserNameOrEmailAddress.IsNullOrEmpty()) { throw new ArgumentNullException(nameof(login.UserNameOrEmailAddress)); } if (login.Password.IsNullOrEmpty()) { throw new ArgumentNullException(nameof(login.Password)); } }
public async Task <IActionResult> Login() { Volo.Abp.Account.Web.Areas.Account.Controllers.Models.UserLoginInfo userLoginInfo = new Volo.Abp.Account.Web.Areas.Account.Controllers.Models.UserLoginInfo { UserNameOrEmailAddress = "testuser", Password = "******", RememberMe = false, }; string userNameOrEmailAddress = "testuser"; string password = "******"; //bool rememberMe = false; string AuthenticationUrl = "https://localhost:44346/api/account/login"; //FormUrlEncodedContent content = new FormUrlEncodedContent(new[] { // //new KeyValuePair<string, string>("grant_type", "password"), // new KeyValuePair<string, string>("userNameOrEmailAddress", userNameOrEmailAddress), // new KeyValuePair<string, string>("password", password), // }); //Controllers.UserLoginInfo content //_oidcClient = new OidcClient(); var usercontent2 = new StringContent(JsonConvert.SerializeObject(userLoginInfo), Encoding.UTF8, "application/json"); var serverClient = _httpClientFactory.CreateClient(); //var response = await serverClient.GetAsync("https://localhost:44346/connect/authorize"); var serverResponse = await serverClient.PostAsync(AuthenticationUrl, usercontent2); if (serverResponse.StatusCode == System.Net.HttpStatusCode.OK) { var data = await serverResponse.Content.ReadAsStringAsync(); AbpLoginResult xx = JsonConvert.DeserializeObject(data) as AbpLoginResult; } return(Ok(new { message = usercontent2, respones = serverResponse.Content })); }
protected virtual async Task ReplaceEmailToUsernameOfInputIfNeeds(UserLoginInfo login) { if (!ValidationHelper.IsValidEmailAddress(login.UserNameOrEmailAddress)) { return; } var userByUsername = await UserManager.FindByNameAsync(login.UserNameOrEmailAddress); if (userByUsername != null) { return; } var userByEmail = await UserManager.FindByEmailAsync(login.UserNameOrEmailAddress); if (userByEmail == null) { return; } login.UserNameOrEmailAddress = userByEmail.UserName; }
public virtual async Task<AbpLoginResult> Login(UserLoginInfo login) { await CheckLocalLoginAsync(); ValidateLoginInfo(login); await ReplaceEmailToUsernameOfInputIfNeeds(login); var signInResult = await SignInManager.PasswordSignInAsync( login.UserNameOrEmailAddress, login.Password, login.RememberMe, true ); await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext() { Identity = IdentitySecurityLogIdentityConsts.Identity, Action = signInResult.ToIdentitySecurityLogAction(), UserName = login.UserNameOrEmailAddress }); return GetAbpLoginResult(signInResult); }
public virtual Task <AbpLoginResult> CheckPasswordCompatible(UserLoginInfo login) { return(CheckPassword(login)); }