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 fails: value too long for type character varying(100) #18

Closed stooj closed 7 years ago

stooj commented 7 years ago

Trying to set this up, but I may be missing something as my modoboa_imap_migration_migration table is empty and generate_offlineimap_config generates an empty config (no accounts).

When I try to log in as a user (doesn't exist in the new server, existed on the old imap server), I get the following:

Request Method: POST
Request URL:    https://mail.example.com/accounts/login/
Django Version: 1.10.8
Exception Type: DataError
Exception Value:    
value too long for type character varying(100)
Exception Location: /srv/modoboa/env/local/lib/python2.7/site-packages/django/db/backends/utils.py in execute, line 64
Python Executable:  /usr/bin/uwsgi-core
Python Version: 2.7.12
Python Path:    
['.',
 '',
 '/srv/modoboa/env/lib/python2.7',
 '/srv/modoboa/env/lib/python2.7/plat-x86_64-linux-gnu',
 '/srv/modoboa/env/lib/python2.7/lib-tk',
 '/srv/modoboa/env/lib/python2.7/lib-old',
 '/srv/modoboa/env/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/srv/modoboa/env/local/lib/python2.7/site-packages']
Server time:    Mon, 25 Sep 2017 16:04:45 +0100

Here's the traceback:

Environment:

Request Method: POST
Request URL: https://mail.example.com/accounts/login/

Django Version: 1.10.8
Python Version: 2.7.12
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.sites',
 'django.contrib.staticfiles',
 'reversion',
 'ckeditor',
 'ckeditor_uploader',
 'rest_framework',
 'rest_framework.authtoken',
 'modoboa',
 'modoboa.core',
 'modoboa.lib',
 'modoboa.admin',
 'modoboa.relaydomains',
 'modoboa.limits',
 'modoboa.parameters',
 'modoboa_amavis',
 'modoboa_pdfcredentials',
 'modoboa_postfix_autoreply',
 'modoboa_sievefilters',
 'modoboa_stats',
 'modoboa_webmail',
 'modoboa_contacts',
 'modoboa_dmarc',
 'modoboa_imap_migration',
 'webpack_loader')
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.core.middleware.LocalConfigMiddleware',
 '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/exception.py" in inner
  42.             response = get_response(request)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _legacy_get_response
  249.             response = self._get_response(request)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
  187.                 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
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

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

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/utils/decorators.py" in inner
  185.                     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
  34.                                 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/auth_backends.py" in authenticate
  46.         return self.get_or_create_user(username, password)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa_imap_migration/auth_backends.py" in get_or_create_user
  64.             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
  85.                 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
  399.         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
  796.                        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
  824.             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
  908.             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
  947.                                using=using, raw=raw)

File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/manager.py" in manager_method
  85.                 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
  1045.         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
  1054.                 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__
  94.                 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: DataError at /accounts/login/
Exception Value: value too long for type character varying(100)
stooj commented 7 years ago

Duplicate of #17