Bottle Login -- Implement users' sessions in Bottle web framework.
- python >= 2.6
Bottle Login should be installed using pip:
pip install bottle-login
from bottle import Bottle, request, redirect from bottle_login import LoginPlugin app = Bottle() app.config['SECRET_KEY'] = 'secret' login = app.install(LoginPlugin()) @login.load_user def load_user_by_id(user_id): # Load user by id here # Some application views @app.route('/') def index(): current_user = login.get_user() return current_user.name @app.route('/signout') def signout(): # Implement logout login.logout_user() return redirect('/') @app.route('/signin') def signin(): # Implement login (you can check passwords here or etc) user_id = int(request.GET.get('user_id')) login.login_user(user_id) return redirect('/')
If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/bottle-login/issues
Development of Bottle Login happens at: https://github.com/klen/bottle-login
- klen (Kirill Klenov)
Licensed under a BSD license.