Validate invite_code in User model, and fix user register issue