comparison pylons_app/controllers/users.py @ 52:25e516447a33

implemented autentication
author marcink
date Thu, 08 Apr 2010 12:00:06 +0200
parents 73f413946c14
children 3f65447f6c02
comparison
equal deleted inserted replaced
51:a699c0088344 52:25e516447a33
5 5
6 from pylons_app.lib.base import BaseController, render 6 from pylons_app.lib.base import BaseController, render
7 from formencode import htmlfill 7 from formencode import htmlfill
8 from pylons_app.model import meta 8 from pylons_app.model import meta
9 from pylons_app.model.db import Users, UserLogs 9 from pylons_app.model.db import Users, UserLogs
10 from pylons_app.lib.auth import authenticate
10 import crypt 11 import crypt
12
11 log = logging.getLogger(__name__) 13 log = logging.getLogger(__name__)
12 14
13 class UsersController(BaseController): 15 class UsersController(BaseController):
14 """REST Controller styled on the Atom Publishing Protocol""" 16 """REST Controller styled on the Atom Publishing Protocol"""
15 # To properly map this controller, ensure your config/routing.py 17 # To properly map this controller, ensure your config/routing.py
16 # file has a resource setup: 18 # file has a resource setup:
17 # map.resource('user', 'users') 19 # map.resource('user', 'users')
18 20
21 @authenticate
19 def __before__(self): 22 def __before__(self):
20 c.staticurl = g.statics 23 c.staticurl = g.statics
21 c.admin_user = session.get('admin_user') 24 c.admin_user = session.get('admin_user')
22 c.admin_username = session.get('admin_username') 25 c.admin_username = session.get('admin_username')
23 self.sa = meta.Session 26 self.sa = meta.Session