I've got a site using Commerce. On checkout a user is created to allow access to files, order history etc.
I just had a customer that couldn't find his files and discovered that he had two accounts registered to the same email address. So it seems my system isn't checking for accounts already registered to the same email address.
How can I make sure that
- There's only registered an account in the event that the email used for the order haven't been used on the site before?
- If the email has been used before the new order is attributed to the existing user?
Edit
After reading @Neograph734's answer below I checked my rules. And they look right to my eyes, so I'm a bit confused as to what can cause this:
Weight 1: Assign an anonymous order to a pre-existing user
Weight 2: Create a new account for an anonymous order