This commit is contained in:
tonio
2010-06-09 11:41:37 +02:00
parent b84c487e95
commit a9f790825e
3 changed files with 13 additions and 1 deletions
+5 -1
View File
@@ -162,13 +162,17 @@ class IMAPconnector(object):
return False, _("Connection to IMAP server failed, check your configuration")
try:
self.m.login(user, passwd)
except imap
except (imaplib.IMAP4.error, ssl.SSLError), error:
return False, _("Authentication failed, check your configuration")
return True, None
def logout(self):
self.m.close()
try:
self.m.close()
except imaplib.IMAP4.error:
pass
self.m.logout()
self.invalid = True
+4
View File
@@ -54,11 +54,15 @@ def menu(**kwargs):
def userlogin(**kwargs):
from imap_listing import IMAPconnector
if kwargs["request"].user.id == 1:
return
m = IMAPconnector(user=kwargs["request"].user.username,
password=kwargs["password"])
def userlogout(**kwargs):
from imap_listing import IMAPconnector
if kwargs["request"].user.id == 1:
return
m = IMAPconnector(user=kwargs["request"].user.username)
m.logout()
+4
View File
@@ -0,0 +1,4 @@
{% extends "layout_simple.html" %}
{% block content %}
<div class="error"><p>{{ error }}</p></div>
{% endblock %}