示例#1
0
        public async Task <IdentityResponse <ApplicationUser> > SignInAsync(string login, string password)
        {
            var response = new IdentityResponse <ApplicationUser>(null);

            response.Result = _userManager.Users.SingleOrDefault(u => u.UserName == login);
            if (response.Result is null)
            {
                response.AddError("User not found");
                return(response);
            }

            var userSigninResult = await _userManager.CheckPasswordAsync(response.Result, password);

            if (!userSigninResult)
            {
                response.AddError("Incorrect password");
            }

            return(response);
        }