/// <summary> /// 校验用户名称密码 /// </summary> /// <param name="access"></param> /// <param name="password"></param> /// <returns></returns> public virtual Task <OperationResult> ValidatorUserAsync(string access, string password) { Argument.NullOrEmpty(access, "access"); Argument.NullOrEmpty(password, "password"); // 获取用户 var query = Repository.Entities(isDeleted); var user = query.SingleOrDefault(m => m.Name == access || m.Email == access); if (user == null) { return(Task.FromResult <OperationResult>( new OperationResult(OperationResultType.QueryNull, String.Format(CultureInfo.CurrentCulture, Resources.UserNoExist , access)))); } //校验密码 if (_passwordValidator.VerifyHashedPassword(user.PasswordHash, password)) { return(Task.FromResult <OperationResult>( new OperationResult(OperationResultType.Success))); } return(Task.FromResult <OperationResult>( new OperationResult(OperationResultType.QueryNull, String.Format(CultureInfo.CurrentCulture, Resources.PasswordError)))); }