Changeset - b2bc08f2974b
[Not reviewed]
default
0 1 0
marcink - 16 years ago 2010-04-07 13:24:46

try except error on non existing user table
1 file changed with 4 insertions and 0 deletions:
0 comments (0 inline, 0 general)
pylons_app/lib/auth.py
Show inline comments
 
@@ -14,14 +14,18 @@ def get_sqlite_cur_conn():
 
    return conn, cur
 

	
 
def authfunc(environ, username, password):
 
    conn, cur = get_sqlite_cur_conn()
 
    password_crypt = crypt.crypt(password, '6a')
 

	
 
    try:
 
    cur.execute("SELECT * FROM users WHERE username=?", (username,))
 
    data = cur.fetchone()
 
    except sqlite3.OperationalError as e:
 
        data = None
 
        log.error(e)
 

	
 
    if data:
 
        if data[3]:
 
            if data[1] == username and data[2] == password_crypt:
 
                log.info('user %s authenticated correctly', username)
 
                
0 comments (0 inline, 0 general)