root/auth.py

Revision 4, 296 bytes (checked in by davea, 3 years ago)

attach imap connection during auth

Line 
1 from mod_python import apache
2 import imaplib
3
4 def authenhandler(req):
5   passwd = req.get_basic_auth_pw()
6   user = req.user
7  
8   imapconn = imaplib.IMAP4()
9   try:
10     imapconn.login(user, passwd)
11     req['imapconn'] = imapconn
12     return apache.OK
13   except:
14     return apache.HTTP_UNAUTHORIZED
15  
Note: See TracBrowser for help on using the browser.