public virtual async Task <IdentityResult> CheckPasswordAsync(string userName, string password) { var errors = new List <IdentityError>(); var user = new User(password) { UserName = userName }; var existsUser = await Repository.ExistsUserAsync(user); if (!existsUser) { errors.Add(ErrorDescriber.UserNotFound()); return(IdentityResult.Fail(errors)); } return(IdentityResult.Success()); }
public virtual async Task <IdentityResult> SignUpAsync(string userName, string password) { var errors = new List <IdentityError>(); var existsUserName = await Repository.ExistsUserNameAsync(userName); if (existsUserName) { errors.Add(ErrorDescriber.UserNameIsExist()); return(IdentityResult.Fail(errors)); } var user = new User(password) { UserName = userName }; await Repository.AddAsync(user); return(IdentityResult.Success()); }