automatically add a prefix to username when login to WP

I use WP multisite installs to host content sites for different customers, and those content sites are used by the app I provide to my customers.
It can happen that people from different customers choose the same WP username.
I have decided to manage this by automatically adding a prefix to the WP username.
When a user logs into my app under "johndoe", he is automatically logged in WP as "7_johndoe" if this customer is assigned #7, which I can get in a config file.
Now I would like people to be able to login directly from a WP page. Problem: they know their username as "johndoe", and I would like them to be able to login as "johndoe", not "7_johndoe".
What would be the trick to automatically add the number prefix to the authentication process, once the user has entered "johndoe" and clicked the login button on the WP login form?
I know how to manage different WP users with same email, but I am stucked with that one.