<commit_before>from ipynbsrv.conf import global_vars
from ipynbsrv.core.models import IpynbUser
from ipynbsrv.core import settings
from ipynbsrv.contract.errors import UserNotFoundError
from django.contrib.auth.models import User
from django_admin_conf_vars.global_vars import config


# TODO: make dynamic
class IpynbsrvAuthentication(object):
    """

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

        # 1. check login credentials with user backend
        user_be = global_vars._get_user_backend()
        internal_ldap = global_vars._get_internal_ldap()

        try:
            print("------------------------------")
            print("authenticate")
            print("connect {0}@{1} mit Passwort {2}".format(username, user_be.server, password))

            # open connection
            user_be.connect({
                "username": str(username),
                "password": str(password)
            })

            if user_be.validate_login({
                "username": str(username),
                "password": str(password)
            }):
                # 2. create user in internal ldap
                try:
                    user_data = user_be.get_user(username)
                    last_django_id = 0
                    if IpynbUser.objects.count() > 0:
                        last_django_id = IpynbUser.objects.latest('id').id

                    user_creation_fields = {
                        "username": str(username),
                        "password": str(password),<commit_msg>remove password from logs<commit_after>from ipynbsrv.conf import global_vars
from ipynbsrv.core.models import IpynbUser
from ipynbsrv.core import settings
from ipynbsrv.contract.errors import UserNotFoundError
from django.contrib.auth.models import User
from django_admin_conf_vars.global_vars import config


# TODO: make dynamic
class IpynbsrvAuthentication(object):
    """

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

        # 1. check login credentials with user backend
        user_be = global_vars._get_user_backend()
        internal_ldap = global_vars._get_internal_ldap()

        try:
            print("------------------------------")
            print("authenticate")
            print("connect {0}@{1} mit Passwort".format(username, user_be.server))

            # open connection
            user_be.connect({
                "username": str(username),
                "password": str(password)
            })

            if user_be.validate_login({
                "username": str(username),
                "password": str(password)
            }):
                # 2. create user in internal ldap
                try:
                    user_data = user_be.get_user(username)
                    last_django_id = 0
                    if IpynbUser.objects.count() > 0:
                        last_django_id = IpynbUser.objects.latest('id').id

                    user_creation_fields = {
                        "username": str(username),
                        "password": str(password),
{'fraction_non_alphanumeric': 0.10753736192332683, 'fraction_numerical': 0.004223521767381416, 'mean_word_length': 1.7788808664259927, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7381703', 'n_tokens_mistral': 827, 'n_tokens_neox': 774, 'n_words': 176}