Unique Username

Your parameters are incorrect. Have a look in your app and the popup’s workflow.
Why have you got user and username in your database? You can do it in user, you don’t need to have two different once, it will complicate things for you.