retspen / webvirtcloud

WebVirtCloud is virtualization web interface for admins and users
1.7k stars 370 forks source link

Error login #445

Open ya-zero opened 3 years ago

ya-zero commented 3 years ago

after run install.sh , login to webvirtcloud, I get an error

settings.py ldap is disable

File "<frozen importlib._bootstrap>" in _call_with_frames_removed
  219. <source code not available>

Exception Type: IndentationError at /accounts/login/
Exception Value: unexpected unindent (ldapbackend.py, line 40)

i'm comment string # "webvirtcloud.ldapbackend.LdapAuthenticationBackend", and successful login.

full listen error

Environment:

Request Method: POST
Request URL: http://10.193.18.100:80/accounts/login/?next=/

Django Version: 2.2.20
Python Version: 3.6.9
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'bootstrap4',
 'django_icons',
 'django_otp',
 'django_otp.plugins.otp_totp',
 'accounts',
 'admin',
 'appsettings',
 'computes',
 'console',
 'datasource',
 'networks',
 'instances',
 'interfaces',
 'nwfilters',
 'storages',
 'secrets',
 'logs',
 'qr_code']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django_otp.middleware.OTPMiddleware',
 'login_required.middleware.LoginRequiredMiddleware',
 'django.contrib.auth.middleware.RemoteUserMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'appsettings.middleware.AppSettingsMiddleware',
 'webvirtcloud.middleware.ExceptionMiddleware']

Traceback:

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/views/generic/base.py" in view
  71.             return self.dispatch(request, *args, **kwargs)

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
  45.         return bound_method(*args, **kwargs)

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/views/decorators/debug.py" in sensitive_post_parameters_wrapper
  76.             return view(request, *args, **kwargs)

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
  45.         return bound_method(*args, **kwargs)

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapped_view
  142.                     response = view_func(request, *args, **kwargs)

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
  45.         return bound_method(*args, **kwargs)

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/contrib/auth/views.py" in dispatch
  61.         return super().dispatch(request, *args, **kwargs)

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/views/generic/base.py" in dispatch
  97.         return handler(request, *args, **kwargs)

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/views/generic/edit.py" in post
  141.         if form.is_valid():

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/forms/forms.py" in is_valid
  185.         return self.is_bound and not self.errors

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/forms/forms.py" in errors
  180.             self.full_clean()

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/forms/forms.py" in full_clean
  382.         self._clean_form()

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/forms/forms.py" in _clean_form
  409.             cleaned_data = self.clean()

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/contrib/auth/forms.py" in clean
  205.             self.user_cache = authenticate(self.request, username=username, password=password)

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/contrib/auth/__init__.py" in authenticate
  66.     for backend, backend_path in _get_backends(return_tuples=True):

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/contrib/auth/__init__.py" in _get_backends
  27.         backend = load_backend(backend_path)

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/contrib/auth/__init__.py" in load_backend
  21.     return import_string(path)()

File "/srv/webvirtcloud/venv/lib/python3.6/site-packages/django/utils/module_loading.py" in import_string
  17.     module = import_module(module_path)

File "/srv/webvirtcloud/venv/lib/python3.6/importlib/__init__.py" in import_module
  126.     return _bootstrap._gcd_import(name[level:], package, level)

File "<frozen importlib._bootstrap>" in _gcd_import
  994. <source code not available>

File "<frozen importlib._bootstrap>" in _find_and_load
  971. <source code not available>

File "<frozen importlib._bootstrap>" in _find_and_load_unlocked
  955. <source code not available>

File "<frozen importlib._bootstrap>" in _load_unlocked
  665. <source code not available>

File "<frozen importlib._bootstrap_external>" in exec_module
  674. <source code not available>

File "<frozen importlib._bootstrap_external>" in get_code
  781. <source code not available>

File "<frozen importlib._bootstrap_external>" in source_to_code
  741. <source code not available>

File "<frozen importlib._bootstrap>" in _call_with_frames_removed
  219. <source code not available>

Exception Type: IndentationError at /accounts/login/
Exception Value: unexpected unindent (ldapbackend.py, line 40)
yan97ao commented 3 years ago

temporary remove "webvirtcloud.ldapbackend.LdapAuthenticationBackend" from AUTHENTICATION_BACKENDS solve this problem. ref: https://github.com/retspen/webvirtcloud/commit/e9b57bfcf702affbad4a8b7c09f75f71c250ef68#diff-36e3384992df46692695e9c140deaf3dd9a891c7deb1f346159df05905ac47a6

catborise commented 3 years ago

install required packages with pip. (Ldap3)

Germwalker commented 3 years ago

I have the same problem on a fresh install, even with the Ldap3 package installed inside the venv with pip. yan97ao's solution is working fine but i guess it's broking the LDAP support.

catborise commented 3 years ago

it is fixed, works by now.