MDL-52781 core_user: add validation to user insertion and updating method