Improve js username validation so it's done only when necessary