'Custom authenticate with bypass for auto-logins
Args:
username (str, optional): Name of user to authenticate.
password (str, optional): Password of user
autologin (Player, optional): If given, assume this is
an already authenticated player and bypass authentication.'

def authenticate(self, username=None, password=None, autologin=None):

    if autologin:
        autologin.backend = 'evennia.web.utils.backends.CaseInsensitiveModelBackend'
        return autologin
    else:
        Player = get_user_model()
        try:
            player = Player.objects.get(username__iexact=username)
            if player.check_password(password):
                return player
            else:
                return None
        except Player.DoesNotExist:
            return None
