private void EnsureIsLoggedInCustomer(ICustomerBase customer, string membershipId) { if (this._cache.RequestCache.GetCacheItem(CacheKeys.EnsureIsLoggedInCustomerValidated(customer.Key)) != null) { return; } var dataValue = this.ContextData.Values.FirstOrDefault(x => x.Key == UmbracoMemberIdDataKey); // If the dataValues do not contain the umbraco member id reinitialize if (!string.IsNullOrEmpty(dataValue.Value)) { // Assert are equal if (!dataValue.Value.Equals(membershipId)) { this.Reinitialize(customer); } return; } if (dataValue.Value != membershipId) { this.Reinitialize(customer); } }
/// <summary> /// Provides an assertion that the customer cookie is associated with the correct customer Umbraco member relation. /// </summary> /// <param name="customer"> /// The customer. /// </param> /// <remarks> /// http://issues.merchello.com/youtrack/issue/M-454 /// </remarks> private void EnsureIsLoggedInCustomer(ICustomerBase customer) { if (_cache.RequestCache.GetCacheItem(CacheKeys.EnsureIsLoggedInCustomerValidated(customer.Key)) != null) { return; } var memberId = _membershipHelper.GetCurrentMemberId(); var dataValue = ContextData.Values.FirstOrDefault(x => x.Key == UmbracoMemberIdDataKey); // If the dataValues do not contain the umbraco member id reinitialize if (!string.IsNullOrEmpty(dataValue.Value)) { // Assert are equal if (!dataValue.Value.Equals(memberId.ToString(CultureInfo.InvariantCulture))) { this.Reinitialize(customer); } return; } if (dataValue.Value != memberId.ToString(CultureInfo.InvariantCulture)) { this.Reinitialize(customer); } }