Changeset 240

Show
Ignore:
Timestamp:
10/06/08 21:11:20 (1 month ago)
Author:
rgrp
Message:

[microfacts/user][l]: address ticket:28 on login/logout for user.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/microfacts.egg-info/paste_deploy_config.ini_tmpl

    r105 r240  
    3737set debug = false 
    3838 
     39# AuthKit (v0.4) config for openid 
     40# see the pylons book chapters on Authentication and Authorization for details 
     41# 
     42# authkit.setup.method = openid,cookie 
     43# authkit.openid.store.type = file 
     44# authkit.openid.store.config = /tmp/www.microfacts.net_passurl_store 
     45# authkit.cookie.secret= mysecret_authkit_cookie_secret 
     46# authkit.cookie.signoutpath = /user/logout 
     47# authkit.openid.path.signedin = /user/login 
     48# authkit.form.template.obj = microfacts.controllers.user:login_form 
     49 
     50# AuthKit (v0.4) form config (better for dev/testing) 
     51# for passurl config see microfacts.egg-info/paste_deploy_config.ini_tmpl 
     52# authkit.setup.method = form, cookie 
     53# authkit.form.authenticate.user.data = okfntest:okfntest 
     54#     testadmin:testadmin 
     55# authkit.cookie.secret = mysecret_authkit_cookie_secret 
     56# authkit.cookie.signoutpath = /user/logout/ 
     57# authkit.form.template.obj = microfacts.controllers.user:login_form 
     58 
    3959 
    4060# Logging configuration 
  • trunk/microfacts/config/middleware.py

    r2 r240  
    4040 
    4141    if asbool(full_stack): 
     42        # added authkit middleware to do authentication 
     43        import authkit.authenticate 
     44        app = authkit.authenticate.middleware(app, app_conf) 
     45     
    4246        # Handle Python exceptions 
    4347        app = ErrorHandler(app, global_conf, error_template=error_template, 
  • trunk/microfacts/lib/base.py

    r230 r240  
    2727        finally: 
    2828            model.Session.remove() 
     29 
     30    def __before__(self, action, **params): 
     31        # what is different between session['user'] and environ['REMOTE_USER'] 
     32        c.user = request.environ.get('REMOTE_USER', None) 
     33        c.remote_addr = request.environ.get('REMOTE_ADDR', 'Unknown IP Address') 
     34        if c.remote_addr == 'localhost' or c.remote_addr == '127.0.0.1': 
     35            # see if it was proxied 
     36            c.remote_addr = request.environ.get('HTTP_X_FORWARDED_FOR', 
     37                    '127.0.0.1') 
     38        if c.user: 
     39            c.author = c.user 
     40        else: 
     41            c.author = c.remote_addr 
     42        c.has_paginate = False 
    2943 
    3044    def _paginate_list(self, register_name, id, template_path): 
  • trunk/microfacts/templates/layout.html

    r237 r240  
    6767            <li><a href="/factlet/">Factlets</a></li> 
    6868            <li><a href="/thread/">Threads</a></li> 
    69             <li><a href="/account/">My Account</a></li> 
     69            <li> 
     70              <a href="${h.url_for(controller='user', action=None, id=None)}">My Account</a> 
     71            </li> 
    7072          </ul> 
    7173        </div> 
  • trunk/setup.py

    r238 r240  
    2424        'Genshi>=0.4', 
    2525        'SQLAlchemy>=0.4.5,<0.4.99', 
     26        'AuthKit==0.4.0', 
     27        'paginate==0.3.2', 
    2628        'geojson>=1.0,<2.0', 
    2729        'Shapely>=1.0,<2.0',