# Path: lobbyauth/models.py
# class UserProfile(models.Model):
#     user = models.OneToOneField(User, on_delete=CASCADE)
#     accountid = models.IntegerField(unique=True)
#     timerank = models.IntegerField()
#     aliases = models.CharField(max_length=2048)
#     country = models.CharField(max_length=2)
#     game_pref = models.SmallIntegerField(default=0)  # id of srs.models.Game
#     game_pref_fixed = models.BooleanField(default=False)
#     is_developer = models.BooleanField(default=False)
# 
#     def __unicode__(self):
#         return "profile for %s (accID: %s | %d)" % (
#             self.user.username,
#             self.user.last_name,
#             self.accountid,
#         )
# 
#     class Meta:
#         ordering = ("user__username",)


import logging
import socket
from xmlrpc.client import ProtocolError, ServerProxy
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from .models import UserProfile
# This file is part of the "spring relay site / srs" program. It is published
# under the GPLv3.
#
# Copyright (C) 2016-2020 Daniel Troeder (daniel #at# admin-box #dot# com)
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

#
# implementing a custom django auth backend here
#
# API doc: https://docs.djangoproject.com/en/1.4/topics/auth/#writing-an-authentication-backend
#

#
# Version 2: uses xml-rpc to talk to uberserver directly (https://github.com/spring/uberserver/issues/138)
# Version 1: used soap to talk to zero-k webservice
#




url = "https://springrts.com/api/uber/xmlrpc"
logger = logging.getLogger(__name__)
UserModel = get_user_model()



# Path: lobbyauth/models.py
# class UserProfile(models.Model):
#     user = models.OneToOneField(User, on_delete=CASCADE)
#     accountid = models.IntegerField(unique=True)
#     timerank = models.IntegerField()
#     aliases = models.CharField(max_length=2048)
#     country = models.CharField(max_length=2)
#     game_pref = models.SmallIntegerField(default=0)  # id of srs.models.Game
#     game_pref_fixed = models.BooleanField(default=False)
#     is_developer = models.BooleanField(default=False)
# 
#     def __unicode__(self):
#         return "profile for %s (accID: %s | %d)" % (
#             self.user.username,
#             self.user.last_name,
#             self.accountid,
#         )
# 
#     class Meta:
#         ordering = ("user__username",)


# Path: lobbyauth/lobbybackend.py
import logging
import socket
from xmlrpc.client import ProtocolError, ServerProxy
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from .models import UserProfile

# This file is part of the "spring relay site / srs" program. It is published
# under the GPLv3.
#
# Copyright (C) 2016-2020 Daniel Troeder (daniel #at# admin-box #dot# com)
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

#
# implementing a custom django auth backend here
#
# API doc: https://docs.djangoproject.com/en/1.4/topics/auth/#writing-an-authentication-backend
#

#
# Version 2: uses xml-rpc to talk to uberserver directly (https://github.com/spring/uberserver/issues/138)
# Version 1: used soap to talk to zero-k webservice
#




url = "https://springrts.com/api/uber/xmlrpc"
logger = logging.getLogger(__name__)
UserModel = get_user_model()



class LobbyBackend(ModelBackend):