modoboa / modoboa-imap-migration

An extension to ease the migration between 2 IMAP servers using offlineimap
ISC License
16 stars 12 forks source link

Logging in a migration account leads to internal error #5

Closed almereyda closed 7 years ago

almereyda commented 8 years ago

While a remote maillog shows successful delegated authentication to the migration source from the migration target's IP, logging in to modoboa yields an internal error.

This does not happen with nonexisting accounts at the remote source.

bildschirmfoto von 2016-07-28 20-45-15

tonioo commented 8 years ago

Could you activate the DEBUG mode please ? I need more information.

almereyda commented 8 years ago

How do I do this? Is there a place in the documentation that covers this?

On 1 August 2016 at 15:41, Antoine Nguyen notifications@github.com wrote:

Could you activate the DEBUG mode please ? I need more information.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/modoboa/modoboa-imap-migration/issues/5#issuecomment-236583503, or mute the thread https://github.com/notifications/unsubscribe-auth/ABka_PVdk9KOgLAgAbS5iCq2-HGF3Wtpks5qbfehgaJpZM4JXhS7 .

dugite-code commented 8 years ago

@almereyda change DEBUG=False to true in /srv/modoboa/instance/instance/settings.py (assuming you used the installer)

I have also run into this issue

Environment:

Request Method: POST
Request URL: https://mydomain.com/accounts/login/

Django Version: 1.9.9
Python Version: 2.7.9
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.sites',
 'django.contrib.staticfiles',
 'reversion',
 'rest_framework.authtoken',
 'rest_framework_swagger',
 'modoboa',
 'modoboa.core',
 'modoboa.lib',
 'modoboa.admin',
 'modoboa.relaydomains',
 'modoboa.limits',
 'modoboa_amavis',
 'modoboa_pdfcredentials',
 'modoboa_postfix_autoreply',
 'modoboa_sievefilters',
 'modoboa_stats',
 'modoboa_webmail',
 'modoboa_imap_migration')
Installed Middleware:
('x_forwarded_for.middleware.XForwardedForMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'modoboa.lib.middleware.AjaxLoginRedirect',
 'modoboa.lib.middleware.CommonExceptionCatcher',
 'modoboa.lib.middleware.RequestCatcherMiddleware')

Traceback:

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  149.                     response = self.process_exception_by_middleware(e, request)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  147.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/utils/decorators.py" in inner
  184.                     return func(*args, **kwargs)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/utils/decorators.py" in inner
  184.                     return func(*args, **kwargs)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  57.         response = view_func(request, *args, **kwargs)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa/core/views/auth.py" in dologin
  24.                                 password=form.cleaned_data["password"])

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py" in authenticate
  74.             user = backend.authenticate(**credentials)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa_imap_migration-1.0.4-py2.7.egg/modoboa_imap_migration/auth_backends.py" in authenticate
  45.         return self.get_or_create_user(username, password)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa_imap_migration-1.0.4-py2.7.egg/modoboa_imap_migration/auth_backends.py" in get_or_create_user
  63.             Migration.objects.create(mailbox=user.mailbox, password=password)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/manager.py" in manager_method
  122.                 return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/query.py" in create
  401.         obj.save(force_insert=True, using=self.db)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/base.py" in save
  708.                        force_update=force_update, update_fields=update_fields)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/base.py" in save_base
  736.             updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/base.py" in _save_table
  820.             result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/base.py" in _do_insert
  859.                                using=using, raw=raw)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/manager.py" in manager_method
  122.                 return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/query.py" in _insert
  1039.         return query.get_compiler(using=using).execute_sql(return_id)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  1060.                 cursor.execute(sql, params)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  79.             return super(CursorDebugWrapper, self).execute(sql, params)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/utils.py" in __exit__
  95.                 six.reraise(dj_exc_type, dj_exc_value, traceback)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /accounts/login/
Exception Value: relation "modoboa_imap_migration_migration" does not exist
LINE 1: INSERT INTO "modoboa_imap_migration_migration" ("mailbox_id"...
                    ^
dugite-code commented 8 years ago

Ah needed to do a migrate so possibly had nothing to do with this issue

$ cd <modoboa_instance_dir>
$ python manage.py migrate modoboa_imap_migration
$ python manage.py load_initial_data
tonioo commented 8 years ago

@almereyda Do you still encounter this issue?