First of all, you have to check your Username Field with RegEx. If the Condition is True then consider it a mail id, you have to log in with your registered Email id. Or else if the condition is false then try with your registered username.
isMatch($Entity/attribute,$RegEx) Please use this condition for your ref.
May be just try to add one email entity separately and add the 1-* association in between this account and email entities there you can store many emails for one account but for sure multiple usernames you can't add I hope so.
Hi, if i understand you well you want the user to be able to sign in with either his username or his email?
You could after the signin button first check if there is a user with the given username by the user, if no account exists with that username, you could check for an account with that email address. If an account exists with that email address, you can pass the username of that account to the sign in action in a nanoflow.
This can be done with any attribute of the user/account entity, but make sure to keep such an attribute unique for each user.