Refactor the checkLoggedIn function

Refactor the checkLoggedIn function to validate that the customer is
allowed in the current store.