Skip to content

Commit

Permalink
Merge pull request #132 from modoboa/fix/password_with_non_ascii
Browse files Browse the repository at this point in the history
unicode_literals can be dangerous...
  • Loading branch information
tonioo committed Nov 17, 2017
2 parents 7cbea4e + bab4435 commit a3a6f29
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions modoboa_webmail/lib/imaputils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
-------------------------------------------
"""

from __future__ import unicode_literals

import email
from functools import wraps
import imaplib
Expand All @@ -16,7 +14,7 @@

import six

from django.utils.encoding import smart_text
from django.utils.encoding import smart_bytes
from django.utils.translation import ugettext as _

from modoboa.lib import imap_utf7 # noqa
Expand Down Expand Up @@ -270,8 +268,6 @@ def login(self, user, passwd):
:param user: username
:param passwd: password
"""
user = smart_text(user)
passwd = smart_text(passwd)
try:
if self.conf["imap_secured"]:
self.m = imaplib.IMAP4_SSL(self.address, self.port)
Expand All @@ -281,7 +277,7 @@ def login(self, user, passwd):
raise ImapError(_("Connection to IMAP server failed: %s" % error))

passwd = self.m._quote(passwd)
data = self._cmd("LOGIN", user, passwd)
data = self._cmd("LOGIN", smart_bytes(user), smart_bytes(passwd))
self.m.state = "AUTH"
if "CAPABILITY" in self.m.untagged_responses:
self.capabilities = (
Expand Down

0 comments on commit a3a6f29

Please sign in to comment.