added before_filter to user_controller to avoid code repetition