Mercurial > public > src > rhodecode
comparison pylons_app/lib/auth.py @ 42:b2bc08f2974b
try except error on non existing user table
author | marcink |
---|---|
date | Wed, 07 Apr 2010 13:24:46 +0200 |
parents | 71ffa932799d |
children | d924b931b488 |
comparison
equal
deleted
inserted
replaced
41:71ffa932799d | 42:b2bc08f2974b |
---|---|
15 | 15 |
16 def authfunc(environ, username, password): | 16 def authfunc(environ, username, password): |
17 conn, cur = get_sqlite_cur_conn() | 17 conn, cur = get_sqlite_cur_conn() |
18 password_crypt = crypt.crypt(password, '6a') | 18 password_crypt = crypt.crypt(password, '6a') |
19 | 19 |
20 cur.execute("SELECT * FROM users WHERE username=?", (username,)) | 20 try: |
21 data = cur.fetchone() | 21 cur.execute("SELECT * FROM users WHERE username=?", (username,)) |
22 data = cur.fetchone() | |
23 except sqlite3.OperationalError as e: | |
24 data = None | |
25 log.error(e) | |
22 | 26 |
23 if data: | 27 if data: |
24 if data[3]: | 28 if data[3]: |
25 if data[1] == username and data[2] == password_crypt: | 29 if data[1] == username and data[2] == password_crypt: |
26 log.info('user %s authenticated correctly', username) | 30 log.info('user %s authenticated correctly', username) |