user_controller.js refactoring