modoboa / modoboa-imap-migration

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

null value in column "name" violates not-null constraint #35

Closed drzraf closed 1 year ago

drzraf commented 6 years ago

On a brand new installation, after configuration, I try to connect using a "to-be-migrated" username:

null value in column "name" violates not-null constraint
DETAIL:  Failing row contains (4, null, 0, t, domain, 2018-08-08 13:25:20.644694+00, 2018-08-08 13:25:20.647377+00, t, 0, null, null, modoboa, , , f).
/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa/core/models.py in populate_callback 
405.   sender="populate_callback", user=user)
Local vars:
grant_access_to_object | <function grant_access_to_object at 0x7f804473ab90>
group | u'SimpleUsers'
sadmins | <QuerySet [<User: admin>]>
user | <User: drzraf>

/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa/admin/handlers.py in account_auto_created
170.  domain.save(creator=sadmins[0])
Local vars:
domain | <Domain: None>
domname | None
kwargs | {'signal': <django.dispatch.dispatcher.Signal object at 0x7f804482a050>}
label | None
localpart | u'drzraf'
sadmins | <QuerySet [<User: admin>]>
sender | u'populate_callback'
user | <User: drzraf>
tonioo commented 6 years ago

@drzraf Actually, it is not a bug. There are two kind of user in modoboa: those with a mailbox and those without. For the first category, we force usernames to be valid email addresses because they must be unique (otherwise dovecot and postfix will complain). In your example, the username is not an email address so it fails.