Guys I too am experiencing this issue on 3.60
It is flooding my database and making my website unusable.
public virtual Customer InsertGuestCustomer()
{
//KEVIN NGUYEN - get current IP address
var currentIpAddress = EngineContext.Current.Resolve<IWebHelper>().GetCurrentIpAddress();
if (CommonHelper.IsValidIpAddress(currentIpAddress))
{
var guest = _customerRepository.Table.Where(x => x.LastIpAddress == currentIpAddress
&& (x.Username == null || x.Username == string.Empty)
&& (x.Email == null || x.Email == string.Empty)
&& !x.IsSystemAccount)?.FirstOrDefault();
if (guest != null)
return guest;
}
var customer = new Customer
{
CustomerGuid = Guid.NewGuid(),
Active = true,
CreatedOnUtc = DateTime.UtcNow,
LastActivityDateUtc = DateTime.UtcNow,
LastIpAddress = currentIpAddress
};
//add to 'Guests' role
var guestRole = GetCustomerRoleBySystemName(NopCustomerDefaults.GuestsRoleName);
if (guestRole == null)
throw new NopException("'Guests' role could not be loaded");
_customerRepository.Insert(customer);
AddCustomerRoleMapping(new CustomerCustomerRoleMapping { CustomerId = customer.Id, CustomerRoleId = guestRole.Id });
return customer;
}