code: def confirm_login_allowed(self, user):
          
          if not user.is_active:
              raise forms.ValidationError(
                  self.error_messages['inactive'],
                  code='inactive',
              )
docs: Controls whether the given User may log in. This is a policy setting,
          independent of end-user authentication. This default behavior is to
          allow login by active users, and reject login by inactive users.
  
          If the given user cannot log in, this method should raise a
          ``forms.ValidationError``.
  
          If the given user may log in, this method should return None.