Registration with username and email required

We know how we can change the user creation in order to have either email or username required but what would we need to specify both?

Extra question: Do you recommend for a real app on production this login or would be a better option create our login from scratch?

Thanks for the comments